The Swiss drew level in Kaliningrad in the 52nd minute when Shaqiri’s shot was blocked and Granit Xhaka blasted the loose ball into the net, cancelling out Aleksandar Mitrovic’s fifth-minute header.
Shaqiri, who sent a fine effort against the post shortly after the equaliser, then completed the turnaround as he finished off a counter-attack with a cool strike past Vladimir Stojkovic.
Serbia felt aggrieved they had not been awarded a penalty in the second half when Mitrovic was caught in a tangle with Stephan Lichtsteiner and Fabian Schar.
The result moves Switzerland into second place in the group, level on four points from two games with Brazil.
Serbia are a point behind in third, with pointless fourth-placed Costa Rica eliminated after their 2-0 loss to Brazil earlier in the day.
In the final round of fixtures Serbia play Brazil and Switzerland face Costa Rica.
Stoke winger Shaqiri and Arsenal midfielder Xhaka were among the players in the Swiss side with links to Kosovo, which declared independence from Serbia ten years ago.
Serbia made a bright start, with Mitrovic to the fore, and moments after he had brought a fine save out of Yann Sommer with one header, the Newcastle striker, who impressed on loan at Fulham last season, scored with another as he connected with Dusan Tadic’s excellent cross.
Switzerland had a decent chance to level five minutes later but Blerim Dzemaili dragged a shot wide, and Serbia were soon applying more pressure as Mitrovic, twice, and Sergej Milinkovic-Savic sent attempts off target.
Having possibly counted themselves lucky to only be a goal down at half-time, Switzerland then equalised in the early stages of the second half. Six minutes after Mitrovic saw another headed effort go just over, Shaqiri’s shot bounced off Nikola Milenkovic and the ball came to Xhaka, who cracked it past Stojkovic.
Shaqiri then almost put his side in front as his wonderful left-footed curler, aimed for the top corner, hit the upright.
Mitrovic was then disbelieving as referee Felix Brych took no action following his tussle with Lichtsteiner and Schar.
And Mitrovic’s anguish increased late on as the Swiss broke forward, the ball was worked to Shaqiri and he slotted past Stojkovic.