Ruler On Ice, a 24-1 shot, logged an official time of 2:30.88 on the muddy track.
Finishing second was Stay Thirsty, while Brilliant Speed took third.
With steady rain falling in New York, the track for Belmont Park was classified as "sloppy" more than 2 hours before post-time.
The upset left the Triple Crown with three different winners. Kentucky Derby winner Animal Kingdom nearly fell just after the start of the Belmont and a late rally fell well short. Preakness Stakes winner Shackleford led most of the way Saturday but couldn't get the 1 1/2-mile distance in the "Test of Champions."
Instead, it was Ruler On Ice, whose road to Belmont Park came not through Louisville but through Sunland Park in New Mexico -- where he finished third in the Sunland Park Derby in March. He then rebounded to finish second in the Federico Tessio Stakes in Maryland in his final Belmont prep.
With Valdivia riding, Ruler On Ice stayed just behind and outside Shackleford. He finally edged to the lead at mid-stretch and won by about a half length over Stay Thirsty. Brilliant Speed was third and Nehro finished fourth. Shackleford finished fifth and Animal Kingdom struggled home sixth.
The final time, over a track officially rated sloppy, was 2:30.88. By contrast, Secretariat's track and stakes record is 2:24.
Winning trainer Kelly Breen was having trouble handling Ruler On Ice after the race as the Roman Ruler colt was still full of spunk.
"He's a little crazy," Breen said. "He's done things you can't imagine a horse can do."
Breen said he told Valdivia he had studied recent runnings of the Belmont and found that "horses that have been in the top four have won it. I said, 'Stay close.'
"He just ran an unbelievable race. It was great."
Ruler On Ice now has three wins from seven career starts. The Belmont was his first stakes triumph.
Animal Kingdom's chances of winning disappeared just a few jumps after the start when he clipped heels with the horse to his outside of him and stumbled.
"I almost came off," jockey John Velazquez said. "I fell so far back, the race was lost at the start … . I knew I was done."
Shackleford simply ran out of gas coming down the stretch but ran credibly for 1 1/4 mile. Since that is the longest distance any of these horses is likely to face during the rest of their careers, a showdown involving the three Triple Crown race winners is a distinct possibility later in the year -- perhaps in the $5 million Breeders' Cup Classic in November at Churchill Downs.
Animal Kingdom was the favorite in the hours leading up to the $1 million race, with Irish import Master of Hounds gaining fans among early bettors.
Animal Kingdom was posted at 2-1 as of 10:30 a.m., according to the Daily Racing Form, with Master of Hounds at 8-1 and Nehro, the Derby show horse, at 4-1.
Other odds had Mucho Macho Man at 8-1, Shackleford at 11-1 and Stay Thirsty at 17-1.