While 2014 winner McIlroy, who was bidding to end an eight-year drought in majors, didn’t really do anything wrong in the closing circuit, it was Smith who got his hands on the Claret Jug.
Helped by a sensational burst of five straight birdies to start the back nine, the 28-year-old Australian signed off with a 64, matching his second-round effort.
Finishing with a 20-under-par 268 total, Smith won by a shot from American Cameron Young, who eagled the last for a 65 in the same group as the new champion.
McIlroy, who had started the day sharing the lead with Norwegian Viktor Hovland and four ahead of Smith, had to settle for third place on 18-under after a closing 70.
After a disappointing day, Hovland (74) ended up joint-fourth with Englishman Tommy Fleetwood (67).
Smith, who landed the Players’ Championship, the game’s so-called fifth major earlier in the year, is the first Australian to become Open champion since Greg Norman did the trick in 1993.
In claiming his victory at St Andrews, the 2022 Chanpion Golfer of the Year followed in the footsteps of two other compatriots, Peter Thomson (1955) and Kel Nagle (1960).
After McIlroy and Hovland, the co-overnight leaders, had traded blows playing together on Saturday, you could sense the excitement in the air as they headed back into battle.
While it may have been down to the occasion, the start on the last day from both players, though, was steady rather than spectacular.
For a spell on Saturday, Hovland holed everything in sight, but his putter had turned cold overnight, squandering a couple of decent early birdie chances before three-putting to bogey the fourth.
McIlroy, who had missed from six feet himself for a birdie at the third, quickly doubled his advantage by finding the heart of the green in two at the par-5 fifth and recording a first red figure of the day.
The cushion they’d started out with meant that no-one could get close enough to apply any real pressure on the front nine.
McIlroy should really have turned for home with a three-shot lead, but, after missing a good chance from 12 feet at the ninth, the tenth proved profitable once more.
He’d holed from a bunker to make an eagle-2 there on Saturday and, on this occasion, his brilliant pace-putting all week was illustrated by leaving himself a tap-in birdie from more than 130 feet.
Up ahead, halfway leader Smith had emerged as his closest challenger after a birdie-birdie start - his 2 at the 11th was like a collector’s item - moved him within two shots of McIlroy.
By then, it had come down to a four-horse race, with only Hovland and Cameron Young, both three behind, looking the only others able to capitalise on any slip ups from the leader over the closing stretch.
Almost in a flash, that turned into leaders as Smith, with a hot putter in his hands, rolled in an 11-footer at the 12th followed by an 18-foot effort at the 13th to make it four straight birdies.
It became five in a row - the first time that had been achieved in the final round since Philip Price did the trick 21 years ago - as he opted to use his flatstick from off the back edge at the 14th and rolled it up beautifully to the side of the hole.
From the front of the green, McIlroy was unable to match that 4 shortly afterwards, meaning it was advantage Smith.
That remained the case as the Australian made one of the great par saves in the history of this historic championship at the 17th.
Left of the Road Hole bunker, he went with his putter again, rolled it down then over the edge of the most-famous bunker in the game to leave himself a 12-footer, which was confidently converted.
McIlroy needed something special. A brilliant approach gave him an opportunity at the 17th only to see a 21-footer die left of the hole.
Up ahead, Young finished in style by rolling in an eagle before Smith, having judged another long putt from just off the green to perfection, signed off with his eighth birdie of the day.
That left McIlroy needing to match Young’s closing 2, but there was to be no late drama. A par to finish meant that he had to settle for third place when his sights setting out had been firmly set on the main prize.
Smith, in fairness, stormed home in 30 - the first player to do the trick in an Open at St Andrews since McIlroy in 2010. Oh, the irony of that.
The success by Smith meant that all four majors were won this year by players in their 20s - the first time that has happened in a calendar year since the inception of the Masters in 1934.
Two-time major winner Dustin Johnson (69) finished as the leading LIV Golf player in a tie for sixth alongside left-hander Brian Harman (66).
Bryson DeChambeau, who’d been tipped to bring the Old Course to its knees, saved his best till last but, even then, a 66 showed that more than brute force alone is needed around here, especially when its firm and fast.
Thai debutant Sadom Kaewkanjana and Mexican Abraham Ancer both made big last-day leaps up the leaderboards with matching 65s, which saw them finish on 11-under.
American Sam Burns posted the best closing score of 64, which included four birdies to finish and catapulted him into the top half of the field.