Joshua won a unanimous verdict, with two judges giving the fight to the Briton 119-110 and the other 119-109.
Ruiz knocked down Joshua four times on the way to a seventh-round upset win in New York in June but there was none of the drama in the rematch as Joshua controlled the fight with his movement and better timing of his punches.
Celebrating his victory, the boxer tweeted an image of himself with the caption "two time".
Neither boxer was sent to the canvas.
Joshua won back the WBA, WBO and IBF belts.
By the end of an unspectacular bout, Joshua was almost running around the ring and Ruiz was planted in the middle, urging him to come closer.
"He boxed me around," Ruiz said, adding that he came in too heavy after putting on 15 pounds since the first match.
"That affected me a lot," he conceded.
It was the first heavyweight title fight to be staged in the Middle East and was played out to a backdrop of concerns that Saudi Arabia was using this and other big sporting events to divert attention from its human-rights violations.
They include the murder of journalist Jamal Khashoggi last year in the Saudi consulate in Istanbul.
Women who attended the fight at the purpose-built, 15,000-capacity Diriyah Arena did not appear to be segregated, as they have been in sports stadiums in Saudi Arabia since being allowed into them for the first time last year.