Defender Frazer Wright's first-half goal proved to be the difference between the sides as he made the most of a brief period of Saints pressure in the opening stages to net from close range and secure his side a precious away goal.
But there were worrying moments following Wright's 19th-minute strike and Tommy Wright's team were forced to defend stoutly to protect their lead.
The Perth side's goalkeeper Alan Mannus in particular did his best to ensure the clean sheet was guarded as he pulled off a string of important saves in the minutes following the start of the second half.
St Johnstone will now hope to complete a remarkable victory when they host the 22-time Norwegian champions in the return leg at McDiarmid Park next Thursday.
Saints started in Trondheim with two of their five summer signings as former Hamilton midfielder Gary McDonald joined ex-Hibernian player David Wotherspoon in their five-man midfield, but there was an early scare for the Scots as Nicki Bille Nielsen dragged a low shot just wide for Rosenborg after 10 minutes.
The Perth side refused to be put off by the prospect of taking on the former Champions League quarter-finalists and threatened themselves as Steven McLean brought out a decent save from former Sweden goalkeeper Daniel Orlund on the quarter hour.
Wotherspoon then drove a yard wide of Orlund's right post but Wright soon had the small travelling band of Saints supporters in raptures as he stabbed home from the former Easter Road midfielder's low corner.
The centre-half was not picked up as he darted to the near post and turned Wotherspoon's delivery into the net after 19 minutes.
A foul on Nigerian forward John Chibuike earned St Johnstone's Steven Anderson the first booking of the match four minutes before the restart but even after the break the visitors refused to sit back and defend their lead.
Wotherspoon tried a chipped effort which deflected off a Norwegian leg, forcing Orlund to quickly adjust his feet before desperately palming the ball away for a corner.
Mannus in the away goal, however, was having to maintain equally high standards as the home side sought an equaliser, first denying Mikle Jensen before saving brilliantly from Daniel Bernsten just past the hour mark.
The Northern Irishman was then required to bravely block an effort by Czech attacker Borek Dockal moments later as the hosts piled on the pressure, and Saints survived until the final whistle with their slender lead intact.