Robbed of the story line horse racing longed to tell, the 144th Belmont Stakes delivered drama nonetheless on Saturday, with Union Rags surging at the rail to spoil what was shaping up to be a wire-to-wire romp by Paynter.

In edging Paynter by a neck, Union Rags, who is based at Fair Hill Training Center in Elkton, Md., handed trainer Bob Baffert a third second-place finish in the season’s three classics. After Baffert’s Bodemeister was edged by I’ll Have Another in both the Kentucky Derby and Preakness Stakes, the trainer opted to field Paynter in the Belmont instead.

Union Rags, a bay colt who had a nightmarish ride in the Derby, completed the final and most daunting leg of horse racing’s Triple Crown in 2 minutes 30.44 seconds.

“We always thought this horse had Triple Crown potential,” said trainer Michael R. Matz, who replaced jockey Julien Leparoux with Belmont veteran John Velazquez following Leparoux’s seventh-place finish aboard Union Rags in the Derby. “I do really think that this horse, when he has a clean trip and can show himself, is he one of the best 3-year-olds of this crop.”

Saturday’s pace was well off the race record of 2:24 set by Secretariat in completing his 1973 Triple Crown with a 31-length victory. The moderate pace frustrated co-favorite Dullahan, who got shuffled back early, struggled to recover and finished seventh.

What makes the Belmont Stakes so daunting is its mile-and-a-half length, alien to 3-year-olds. But on Saturday the pivotal distance was a matter of inches: The width of the opening Paynter created when he drifted away from the rail on the stretch, allowing Union Rags the critical opening.

“Nobody would have gotten through on the rail other than Johnny today, I can tell you that,” said Phyllis Wyeth, 71, Union Rags’s jubilant owner, a former accomplished steeplechase rider and wife of the artist Jamie Wyeth. “That was unbelievable. He just said, ‘Move over. I’m coming.’ ”

While the finish was thrilling, there was no denying that the withdrawal of I’ll Have Another, who had been favored to become the first horse to win the Triple Crown since Affirmed in 1978, reduced a potentially historic race to a more routine contest.

I’ll Have Another, the chestnut colt who won the Kentucky Derby and Preakness Stakes with breathtaking closing speed, was scratched from the field and retired Friday after having tendinitis diagnosed in his left front leg.

It wasn’t that Saturday’s 11-horse field lacked worthy contenders. Union Rags and Dullahan, co-favorites after the odds were recalculated, were more rested than a healthy I’ll Have Another would have been after they skipped the May 19 Preakness Stakes to be fresh for the Belmont.

In fact, Saturday’s top three finishers all skipped the Preakness, the middle leg of the series.

The lightly raced Paynter bolted out of the gate and led the horses through the first turn, with Unstoppable U and Optimizer close behind.

Paynter held his ground while keeping the pace moderate. With four furlongs remaining in the 12-furlong test, he still held his challengers at bay. But as Paynter charged toward the finish, looking sure to deliver the victory Baffert had been twice denied with Bodemeister, veteran jockey Mike Smith let his horse drift from the rail.

It was a critical mistake. It created just enough of an opening for Union Rags to squeeze through. Once he poked his nose in fresh air, Union Rags surged forward and seized the lead.

Atigun, with Leparoux aboard, finished third.

The crowd of 85,811 was less than the 100,000 promoters expected with a Triple Crown at stake, but nearly a 54 percent increase over last year’s turnout of 55,779.

And the presence of the top drawing card, I’ll Have Another, was felt throughout the day.

Vendors gave out free posters of the chestnut colt. A notable number of men sported purple ties, a nod to I’ll Have Another’s purple silks.

In the winner’s circle roughly 40 minutes before post time, I’ll Have Another was ceremoniously retired. Jockey Mario Gutierrez, sporting a white dress shirt and tie in the saddle, gently stroked the colt’s neck as flashbulbs popped. Gutierrez dismounted, allowing trainer Doug O’Neill to remove the colt’s saddle. He was led away by a groom, with his stable pony Lava Man trailing behind.

I’ll Have Another retired with seven career starts but unbeaten and unbowed in 2012, a spectacular year in which he came within a victory of the Triple Crown.