A Bronx man died six days after he was bashed in the head in his Bronx apartment building — and cops have arrested a suspect for murder, police said Sunday.

Joel Rivera, 44, was struck in the head with a blunt object in an apartment in the Muller Residences in Wakefield about 7 p.m. Jan. 21, cops said.

Rivera lived in the building on Neried Ave. near Bullard Ave., which provides affordable and supportive housing for veterans.

A worker at the apartment building said that Rivera and his attacker got into a fight, with the victim suffering bleeding to his brain.

Medics rushed Rivera unconscious and unresponsive to Jacobi Medical Center, where he died Jan. 27. The city Medical Examiner ruled his death a homicide on Feb. 6 after conducting an autopsy.

“Joel’s generosity extended beyond his life, as he was an organ donor, giving the gift of hope to others,” Rivera’s obitiary says.

On Feb. 14, cops arrested Richard Vasquez, 37, for murder. Vasquez lives with his grandparents a few blocks away from the Muller Residences.

Vasquez was ordered held without bail after being arraigned in Bronx Criminal Court. He is due back in court March 16.

An NYPD spokesman had no information about the motive behind the killing.

Rivera’s cousin, Shyann Camacho, 26, told the Daily News that the killing came as a complete shock.

“This came from left field,” Camacho said. “Nobody expected this at all.”

Camacho described Rivera as “a super charming, super funny, life-of-the-party kind of guy.”

“He had a bunch of family,” she added. “Our family is super extended. Everybody was raised together.”

The suspect’s family is also shocked by the slaying.

“He’s been living with me and my wife for three years,” said Vasquez’s grandfather Narisco Perez. “He moved from Albany. He has no other family in New York.”

“Anything he did is new to me,” he said of the murder charge against his grandson, adding that he doesn’t recognize the name of the victim. “I am 82. I can’t tell him, ‘Hey, what you doin?’ I am old.”

“He was out most days all day. I don’t know what he did outside,” he added. “I don’t know what he did for work … He liked to cook. He would sometimes cook for me and my wife.”

Tributes to Rivera have poured in on social media and on an online obituary.

“My heart breaks as I write this. Big bro, Disco Ball extraordinaire, Joe Cheese, your most recent Don Juan D’Marco,” his sister, Giovanna Rivera, wrote on Facebook. “Boy you could tell a story, you always had the ones around you laughing. You lived life carefree, your way!”

“Big bro I miss you already,” she added. “I love you with ALL OF ME! I hope you knew that. Your name will live on FOREVER.”

Rivera leaves behind his sister, his mom, his nephew and his niece, according to his obituary.

“Joel had a way of lighting up any room he entered, known for his infectious smile and playful, prank-loving spirit. He lived life to the fullest, always on the edge of his seat, embracing each moment with enthusiasm and heart. Joel loved to cook and never hesitated to share a plate of food with anyone—hospitality came naturally to him,” the obituary reads.

“His most precious treasure was his beloved dog, Scarlito, whom he spoiled endlessly and loved unconditionally.”

Camacho, Rivera’s cousin, hadn’t heard about an arrest in his killing until Sunday, but she said the news brought her some relief.

“Justice needs to be served,” she said.