Rapper Troy Ave was shot twice Sunday while sitting in his red Maserati in Brooklyn, sources said.

The shooting unfolded in Canarsie at East 91st Street and Linden Boulevard around 4:20 p.m, according to police.

The hometown hip-hop star was grazed in the head and struck once in the arm as he sat in the six-figure sports car with his girlfriend, sources said.

His shooter walked up and opened fire without warning — blasting out the driver-side window, cops said.

Ave, 34, cruised for a couple blocks before driving off the road and leaving behind the convertible Maserati, which was still facing the wrong way in the westbound lane of Linden Boulevard as of 8 p.m.

A good Samaritan took him to Brookdale Hospital, where he was listed in stable condition, sources said.

When asked how he was doing, a bandaged-up Ave told The Post, “Shot in the head, man,” before being wheeled away by medical staff.

A photo that was later posted to Instagram by rapper 50 Cent showed the Brooklyn MC laid up in a hospital bed.

“Dope boy Troy all good,” the caption read. “Merry Christmas.”

https://www.instagram.com/p/BOd3WUAAIFR/

Ave — born Roland Collins — was slapped with attempted murder and weapons possession charges earlier this year after he was involved in a shooting at Irving Plaza during a T.I. concert.

The headline-grabbing incident left his friend and bodyguard, Ronald McPhatter, dead and Ave with a gunshot wound to his right leg.

Despite surveillance footage that showed him firing a pistol, Ave pleaded not guilty and claimed that he was the victim of a calculated hit. He has long insisted that the weapon used to kill McPhatter didn’t belong to him or anyone in his entourage.

Ave later rapped about the shooting, saying: “I’m a pretty fly ni—a that’ll shoot ya.”

Cops are still investigating the Sunday incident and have not yet released a description of the suspect or suspects.

Ave’s lawyer, Scott E. Leemon, released a statement afterward condemning those responsible.

“Tonight, Troy Ave was targeted again … on Christmas,” he said. “In Brooklyn, going to meet his family for the holiday, he was shot two times. Thankfully, he will survive the second attempt on his life.”

“As we have said from the beginning — he is a victim,” Leemon added. “We pray for his speedy recovery.”