The former world number one had only lost three of his previous 35 singles matches in the competition and never to a player ranked as low as world number 152 Riedi.
But the big-hitting 21-year-old produced a performance well above that and, after failing to take his chances in the opening set, Murray needed all his nous to grind out a 6-7 (7) 6-4 6-4 victory in three hours and 10 minutes.
It was another demonstration that, for all his frustration at being unable to get back in the mix at grand slams, the competitive fire still burns brightly within Murray and to get over the line in an important match for his country undoubtedly meant a lot.
The 36-year-old said: “It’s obviously incredible to get through that one, it easily could have gone the other way. It was ridiculous the shots he was pulling off, amazing, amazing returning. I kept fighting and tried to stay focused and managed to turn it round.”
Having seen his gamble to play debutant Jack Draper and Dan Evans handsomely pay off in Wednesday’s victory over Australia, captain Leon Smith made use of his options by naming Murray and Cameron Norrie as his singles players here.
Evans’ 0-5 record against Stan Wawrinka may have played a part in his thinking along perhaps with caution not to over-play Draper given his physical fragility this year.
Murray played singles against Kazakhstan at the same stage last year but only once Britain were already eliminated, making this his first live singles rubber in the competition since 2019 and only his second in seven years.
Switzerland also sprang a surprise by picking Riedi ahead of their number two Dominic Stricker, and Murray admitted that had thrown him having prepared to face a left-hander.
After negotiating an 11-minute first game, the Scot broke serve immediately and had a chance to open up a 4-0 lead.
He could not take it, though, and Riedi worked his way into the contest, beginning to cause Murray increasing problems with his big forehand and aggressive tactics.
They earned him a break back when the Scot served for the set at 5-3, and Murray was then unable to take two set points in the tie-break, Riedi converting his first opportunity with his 22nd winner.
The young Swiss, who had never previously beaten a top-50 player, had his tail up and Murray kicked his bag in frustration after failing to break in the third game of the second set.
He finally made the breakthrough at 3-3 when Riedi double-faulted only for the 21-year-old to leave his opponent rooted to the spot with a series of blistering returns.
Undeterred, Murray engineered another break and this time held onto it with trademark grim determination to level the match.
The Scot has been in similar situations hundreds of times during his career and ultimately experience won out, although it was still nip and tuck, with Murray slamming his racket to the court after handing an early break back in the decider.
He broke again to lead 3-2, though, and quashed Riedi’s hopes of a comeback by taking his first match point with an ace.