The win puts Switzerland in pole position to make it out of a tough Group E that contains five-times winners Brazil but they were pushed all the way by the Serbs.
It was a sweet victory for Shaqiri and fellow Swiss goalscorer Granit Xhaka, who along with team-mate Valon Belrami were booed relentlessly by Serbia's fans throughout.
Shaqiri, Xhaka and Belrami trace their roots to Kosovo, a former province of Serbia, a fact which had stoked tensions before the match.
World Cup: Why Kosovo will be cheering on Switzerland against Serbia https://t.co/7RlmicWb5e pic.twitter.com/ajIAcKiG6C
— The Local Switzerland (@TheLocalSwitzer) June 20, 2018
Both Shaqiri and Xhaka pointedly celebrated their goals by making an eagle gesture with their hands, viewed as a symbol of defiance.
However, some were quick to take to social media to point out that the gesture could be seen as provocative, had no place in a football match, or was simply stupid.
Glückwunsch an die Schweiz! Nur was nicht dazu gehört ist, dass der Shaqiri und Co. den Jubel als Platform für Ihre politischen Provokationen verwenden…Der Albanische Adler wird gezeigt! Echt nervig dieses primitive Verhalten! #SRBSUI
— Alex (@AlexHar82) June 22, 2018
Dank hoch-motivierter Kosovaren im Achtelfinale! Und was tun wir? Meckern über den #Doppeladler. DAS ist dämlich… #SUISER #WM2018 pic.twitter.com/2jv8ZQ1fEL
— Erwin Schmid (@ErwinSchmid) June 22, 2018
Serbia raced out of the blocks, funnelling possession to Southampton winger Dusan Tadic on the right flank, who troubled Switzerland with his crossing all match.
An Aleksandar Mitrovic header forced a smart save from Swiss keeper Yann Sommer after four minutes.
Read also: Is Switzerland's 'splattered brains' jersey the World Cup's worst?
Seconds later, Tadic took the ball past left-back Ricardo Rodriguez, cut back on his favoured left foot and delivered a majestic cross that Mitrovic duly buried with his head.
Granit Xhaka is just the 3rd Swiss player to score in more than one World Cup. Others were Jacques Fatton (50/54) and Andre Abegglen (34/38). Thought you should know that.
— Gary Lineker (@GaryLineker) June 22, 2018
In a frenetic first half, Switzerland had more of the ball but were sloppy with it, giving away possession in advanced positions and sending Serbia on the break.
Lazio's highly rated Sergej Milinkovic-Savic fizzed a right-footed shot narrowly wide of Sommer's right post on 15 minutes, and Mitrovic almost scored with a spectacular bicycle kick that went the same way minutes later.
Switzerland, who came to Russia ranked ahead of the likes of France and Spain, felt their way into the game as the first-half progressed.
On the half-hour mark, Steven Zuber cleverly teed up Blerim Dzemaili but the Hoffenheim man got his feet in a muddle and Vladimir Stojkovic was able to parry away.
SWITZERLAND WON AND SOMEONE IN THE AUDIENCE JUST THREW AN *ENTIRE CHEESE WHEEL* #WorldCup pic.twitter.com/qyqb1GKo4V
— kami @ recovery (@kamidog) June 22, 2018
But it was Serbia, who beat Costa Rica 1-0 in their Group E opener, who nearly went in two up.
Nemanja Matic missed a glorious chance to double the lead just before the break when Tadic's in-swinging corner found him unmarked at the back post but the Manchester United midfielder couldn't sort his feet out.
Matic said during the build-up the team were expecting a “hellish” encounter with the Swiss, who in their game with Brazil fouled star forward Neymar 10 times alone.
Switzerland grew in stature after the break and were rewarded with a spectacular equaliser courtesy of Xhaka's 52nd-minute piledriver.
They had the better chances in the second period, with Shaqiri's curling effort from the edge of the area grazing Stojkovic's bar on the hour mark.
Coach Vladimir Petkovic brought on attackers Breel Embolo and Mario Gavranovic in a bid to force a winner, and Gavranovic forced a smart save from Stojkovic from a close range effort with 10 minutes remaining.
But it was Stoke City winger Shaqiri who struck the decisive blow, breaking through Serbia's offside trap to slot home calmly as the 90 minutes wound down.
Serbia will now need something from their final Group E match against Brazil, while a draw against Costa Rica would see Switzerland through.
Kosovo Albanian supporters of Switzerland celebrate the goal of Granit Xhaka as they watch a telecast in a pub in Pristina. Photo: AFP