NEW YORK — Andy Ruiz Jr. had six weeks to prepare for the fight of his life.

He’ll have a lifetime to celebrate one of boxing’s biggest heavyweight stunners.

A massive underdog just like Buster Douglas, Ruiz knocked down British champion Anthony Joshua four times, and the final two in the seventh round proved the decisive blows.

Ruiz, the first heavyweight of Mexican descent to win a heavyweight title, capped one of boxing’s epic upsets to win Joshua’s shares of the heavyweight championship Saturday night at Madison Square Garden.

"I just feel so good, man," Ruiz said. "This is what I’ve been dreaming about, this is what I’ve been working hard for. I can’t believe I just made my dreams come true."

Ruiz etched his name in heavyweight lore by TKO at 1:27 in the seventh round to become the surprise champ in a bout that had shades of Douglas’ upset over Mike Tyson for the heavyweight title in 1990. Ruiz barely was on anyone’s heavyweight radar when he was summoned as a replacement to fight the undefeated Joshua in front of a packed Garden.

Considered a joke by fans, all Ruiz did was dominate the British champion and used a TKO to turn his life and the heavyweight division upside down. Ruiz racked up 32 wins without beating many boxers of note and walked into the ring with a waistline that will need a supersized championship belt.

Ruiz, a flabby fighter out of Southern California, came up short in his only other shot at a world title, having lost on points to then-WBO champion Joseph Parker in December 2016.

Ruiz even warned Joshua before the fight: "Don’t underestimate this little fat boy."

The 270-pound heavyset heavyweight knocked down Joshua twice in the third round and did it two more times in the seventh before referee Mike Griffin ended the fight. Joshua was woozy and seemed to stumble toward the wrong corner after the final blow.

Ruiz stepped in after fighting on April 20, when he stopped Alexander Dimitrenko. Jarrell Miller’s failed drug tests sent the challenger to the sideline and paved the way for Ruiz’s unexpected title shot. Ruiz (33-1, 21 KO’s) seized the opportunity and made boxing history to win the WBA/IBF/WBO/IBO championships. He raised his arms in celebration and jumped around the ring as his corner quickly mobbed him and a wild celebration kicked off.

"I’ve got that Mexican blood in me," he said. "Talking about the Mexican style? I just proved it."

The true shock might have been that the Garden was packed on a Saturday night for a fight few expected to be competitive. Yes, Ruiz is up there with Douglas and Hasim Rahman for who-can-believe-it wins, but casual sports fans don’t even know the names of most boxing champions — consider, instead of pay-per-view parties, this card was streamed by DAZN.

When ring announcer Michael Buffer announced the name of the judges "should this fight go the distance," fans laughed at the ridiculous possibility as Ruiz was an ultimate underdog.

Joshua (22-1, 22 KO’s) and Ruiz were both knocked down in an electrifying third round that had the sellout crowd of 20,201 howling with each heavy hit. Joshua knocked down Ruiz early in the round and the promise of an early finish seemed horizon.

Ruiz, his trunks a bit too low for his portly frame, came right back and used an overhand right that rocked the champ and sent him to the canvas. Joshua recovered only to get pummeled in the corner. Ruiz knocked him down again in the final ticks of the round as fans in a disbelieving Garden crowd screamed "Oh my God!" Again, Joshua beat the count but the bell saved the Brit from a going a second longer in his weakened state. Had it not been a championship fight, perhaps Griffin would have stopped the bout.

Alas, for Joshua, it went on.

Ruiz, whose father, a native of Mexico, got him into the gym when he was 6 and had his son in bouts a year later, shook up the boxing world. Johsua was the fan favourite and had all the hype for his first fight in the United States.

"If it wasn’t for my dad, I wouldn’t be here," Ruiz said.

NBA star Kyrie Irving and rapper Meek Mill were among the celebrities in the house expecting Joshua to roll to a win and set up more ambitious, lucrative bouts against the likes of Tyson Fury, Deontay Wilder and a few other potential opponents.

"Sorry I let my fans down, sorry I let my supporters down," Joshua said.

Ruiz made some new ones.

"It is never over until it’s over with the Mexicans. God bless them. Congrats Andy Ruiz," former UFC champion Conor McGregor tweeted.

Wilder, owner of the WBC crown, decided to give Luis Ortiz a rematch. Ortiz battered Wilder for parts of their fight in early 2018 before running out of gas and getting knocked out.

Wilder tried to steal the headlines this week when he announced his rematch with Fury was set for 2020. Wilder and Fury fought to a split draw in December in Los Angeles, with Wilder retaining his WBC heavyweight title after knocking down his British challenger twice.

Joshua instead heads toward a likely rematch against Ruiz later this year.

Fans booed when Ruiz was shown on the big screen holding a personalized Knicks jersey. He walked out to his press conference wearing the jersey — his coronation complete, a table full of championship belts all for him.

"My life is going to change," he said. "I don’t have to show them no more."