Megan Thee Stallion was shot in the feet on July 12. She initially declined to name the suspect but later publicly said it was Lanez, whose legal name is Daystar Peterson.
The Los Angeles County District Attorney's Office on Thursday said Lanez has been charged "with one felony count each of assault with a semiautomatic firearm - personal use of a firearm - and carrying a loaded, unregistered firearm in a vehicle. The defendant also faces a gun allegation and that he personally inflicted great bodily injury."
Lanez is scheduled for arraignment on Oct. 13.
If convicted of all charges, Lanez faces a maximum of 22 years and eight months in state prison.
The DA's office says the shooting happened after Lanez and Megan Thee Stallion got into an argument while riding in an SUV in the Hollywood Hills. She got out of the vehicle and that's when he allegedly fired several times at feet, wounding her.
The singer, whose legal name is Megan Pete, named Lanez publicly in an Instagram Live video about a month after the shooting. She said at first she didn't tell the police anything because she was afraid. But she released the Instagram Live video after what she says were false statements by Lanez.
"Yes ... Tory shot me. You shot me and you got your publicist and your people going to these blogs lying," the rapper said the Instagram video. "Stop lying. Why lie? I don't understand."
Pete, Peterson and others were sharing an SUV after the party in the early hours of July 12. She said in the video that there was an argument between the people in the vehicle, and Peterson shot her when she tried to walk away. She denied rumors that she had hit him in the SUV.
Lanez has not spoken publicly about the incident. On Sept. 24, he said on his social media accounts that he would break his silence that evening, but that announcement turned out to be a teaser for the release of his fifth studio album, "Daystar."
Lanez has not reached the stardom that Megan the Stallion has, but had a Billboard top 20 hit with "Luv" in 2016, and has had a successful run of mixtapes and major-label records since his career began in 2009.
At the time of the shooting, Megan Thee Stallion was already a major hip-hop star following a triumphant year that saw her nominated for artist of the year at the MTV Video Music Awards. Since the shooting, her guest stint on the Cardi B song "WAP" helped turn the track - and music video - into a huge cultural phenomenon, and she has performed on the season premiere of "Saturday Night Live."
The Associated Press contributed to this report.