"Thank y'all for saving my life," he told jurors as they left the Los Angeles courtroom. They cleared him of two felony counts of assault with a semiautomatic firearm.
After the verdict was read, the 36-year-old hip-hop star, fashion mogul and burgeoning actor - whose legal name is Rakim Mayers - dove into the courtroom gallery to hug his longtime partner, Rihanna.
He risked a sentence of 24 years in prison if he had been convicted.
On the eve of trial, he turned down a prosecution offer of just six months in jail, along with probation and other conditions, if he would plead guilty to one count.
Insisting on his innocence, Rocky decided to gamble that a jury would feel the same. It paid off. The jurors felt at least that there was reasonable doubt of his guilt.
When the verdict was read on Tuesday, Rihanna cried and hugged the defence lawyers.
She attended the trial sporadically and brought the couple's two sons - two-year-old RZA Athelston Mayers and one-year-old Riot Rose Mayers - for some of the closing arguments.
The verdict came at the height of Rocky's fame, if not the pinnacle of his music career.
The three-time Grammy nominee has a banner year in the works, and can now look to it without the threat of prison hanging over him.
He is scheduled to headline the Rolling Loud music festival in March; he is one of the celebrity co-chairs of fashion's biggest night, the Met Gala, in May; and he stars with Denzel Washington in director Spike Lee's upcoming film "Highest 2 Lowest".
Prosecutors and their witnesses said he was beefing with a former friend, A$AP Relli, with whom he had been in a crew who called themselves the A$AP Mob since high school.
They said the two men met up in Hollywood on November 6, 2021, and after a scuffle Rocky pulled the gun and fired twice at Relli, who said one of the shots grazed his knuckle but was not seriously hurt.
Rocky's lawyer Joe Tacopina said in his closing argument that Relli is "an angry pathological liar" who "committed perjury again and again and again and again".
Rocky's lawyers and witnesses they called said Rocky had shot a prop gun that only fires blanks, which he had been carrying for security since taking it from a music video set months earlier.
They said he fired it as a warning because Relli was attacking another member of their crew.
The jurors were told that despite three years passing since the incident, no one mentioned the phony gun to authorities until the day jury selection began at the trial.
They were also instructed that if they found that Rocky reasonably believed that he or one of the two friends with him that night were in imminent danger of injury, and that he used reasonable force, they could find the defendant not guilty.