Dogged Ruiz put Joshua down four times during the contest before the fight was stopped in a shock compared to the upset suffered by Mike Tyson against Buster Douglas in 1990.
Joshua had set his sights on a mega fight with countryman Tyson Fury or WBC heavyweight title holder Deontay Wilder, but those elite match-ups seem a distant premise following his first fight in the US.
Starting the fight as a 1/25 on bet with the bookies, Joshua seemed poised for a routine win when he sent Ruiz to the canvas in the third round.
He was then floored by an almost immediate response from Ruiz, who had stepped in at 41 days’ notice and been considered little threat ahead of the fight.
Joshua never seemed to fully recovering from his first fall, and was caught by a counter again as Ruiz sent him sprawling twice in the final round, prompting the match referee to declare a TKO.
Anthony Joshua news – when is Anthony Joshua’s next fight?
Joshua had already had a fight scheduled for the end of the year. That is now almost certain to be a rematch against Ruiz.
Speaking in a solemn post-fight press conference, promoter Eddie Hearn said: “Every day that goes by, he’ll want that rematch more and more.
“Nothing changes apart from that he’s had a defeat. Going into tonight we didn’t know what was coming next, in November or December or whenever it was.
“Now I think we do, but there is a lot of pressure on that fight. It’s a huge fight.
“Every day that passes, his hunger will burn deeper to avenge that loss because he’s a competitor.”
Joshua will probably return to the UK when he bids to reclaim his IBF, WBA and WBO world titles.
Asked where the rematch would be held, Hearn replied: “For me, UK – but we’ll sit down as a team.
“It didn’t go our way tonight but we wanted to create a night that people will remember for a long time to come.
“Unfortunately they’ll remember it for the shock defeat and an incredible night of boxing, but he’s always wanted to do that – give people value for money and great nights.
“The revenge will be sweet and I believe he’ll get it.”
A disconsolate Joshua reflected: “It’s a test of character.
“I’m not going to blame anything. Andy Ruiz was the better man. I’ve got to take that on the chin and roll with the punches.
“We don’t fold. I’ve got a really great team. We stand strong at all times and I will address the situation that happened tonight and then we move forward onto the next.
“Tomorrow comes. It’s all good.”