The Briton, 29, has lost all three of his IBF, WBA and WBO heavyweight titles after being stopped in the seventh round in front of a disbelieving crowd at Madison Square Garden.
He had spent much of rounds four to six recovering from what was possibly the most damaging round of his career in the third, during which he was knocked down twice.
It was the first time Joshua had tasted defeat, leaving his underdog opponent to become the first ever Mexican-American heavyweight world champion.
“This is what I have been dreaming about and I cannot believe I made my dreams come true,” said Ruiz, who Joshua managed to knock down once in the third round.
“That was my first time getting dropped on the floor but it made me want it even more – and I just thank god. I have got that Mexican blood in me and that just proved it. Right now, I just want to celebrate. I made history for Mexico.”
Joshua was not in the mood to offer excuses for his performance and paid tribute to his opponent.
He told Sky Sports Box Office: “Boxing is a tough sport, but I train hard and I got beaten by a good fighter, it will be interesting to see how far he goes, but this is all part of the journey.
“This is the risk we take, every fighter deserves respect so congratulations to him. I respect every fighter, this is all part of the legacy, it’s how strong I came back. He’s a champion for now, I shall return.”
Joshua had beaten 22 opponents without defeat before his Saturday night fight against Ruiz, and apologised to his fans who had bought tickets for the match.
“Sorry I let my fans down,” he said.