Striker Simeon Jackson scored the only goal with a late header as Gillingham dramatically won the League Two play-off final at Wembley.
The match appeared to be heading for extra-time before Jackson's 90th-minute finish from Josh Wright's corner settled the tie in his team's favour.
Shrewsbury had come into the match in the second half after a disappointing opening 45 minutes and should have scored through Kevin McIntyre but he headed wide from six yards, while Ben Davies had a volley saved.
And their failure to convert their chances was punished when Gills top scorer Jackson struck to ensure that the Gills return straight back to League One.
Gills boss Mark Stimson has rebuilt his side since taking over as manager in November 2007 and promotion is vindication of his methods after he failed to prevent them from slipping to relegation last season.
It might have been a different story if Shrewsbury had taken the lead inside the first minute, but Gills skipper Barry Fuller ended a moment of panic by smashing the loose ball clear from eight yards before his own keeper or anybody from the opposition could reach it.
The opening half hour was largely disappointing, and neither team managed a shot on target until John Nutter's sweet 14-yard left-foot strike forced Luke Daniels into action after 31 minutes.
Gillingham, unchanged from the team that defeated Rochdale in their semi-final tie, were the far better side before the break, with the likes of Curtis Weston, Dennis Oli and Andy Barcham showing a willingness to run at the opposition.
Stimson's side often worked the ball forward with some style but frequently disappointed with the quality of their crossing. However, Graham Coughlan and Darren Moss both had to make hasty clearances from balls swung in from the right, while Wright shot over from 20 yards after a corner was half cleared.
The Shrews looked nervous and struggled to retain possession - and by the break had only a Davies free-kick that drifted wide of the post to show for their efforts.
Jackson pounced in the last minute of normal time
In fact, they might have conceded in injury-time after Wright drilled a low shot across goal through a cluster of players but Daniels made a sharp save diving low to his right.
The pattern looked set to continue after the break, with Barcham turning his marker inside and out before forcing Daniels to make a decent one-handed save with a strike from a tight angle.
But the Shrews fired a warning to their opponents through Davies, who pounced on a misdirected defensive header from the otherwise excellent Simon King and forced Simon Royce into action with a rasping volley.
The Shropshire team grew in confidence and for the first time in the match Shrewsbury had a sustained spell of possession. McIntyre ought to have given them the lead but headed wide from inside the six-yard box. It was an awful miss from the 28-year-old midfielder but at least his team were starting to show some attacking threat.
In contrast with the drab opening half, the final had finally become a contest, with both sides enjoys periods in the ascendancy.
The largely peripheral Jackson miscued for the Gills, while Davies was played clean through for Shrewsbury but could not quite get his shot off under pressure.
Shrews boss Paul Simpson brought on David Worrall and Omer Riza as his team looked for the opening goal but as time ticked down, there seemed to be little prospect of a decisive finish from either side before Jackson, who had otherwise had a quite afternoon, struck.
Coughlan almost restored parity but he could not keep is header on target and the Shrews tasted Wembley disappointment again after their defeat to Bristol Rovers in the League Two play-off final in 2007.
Gillingham manager Mark Stimson:
"It's massive financially. There are several local teams we can attract and with Leeds, Norwich and Southampton coming down we will have some big gates.
"We brought over 30,000 fans to Wembley today and we need to attract as many of them as we can every week.
"We had already arranged meetings with some players for next week regardless of what league we were going to be in.
"We need to improve the squad and we have to try and become a good League One side."
Shrewsbury boss Paul Simpson: "It wasn't a corner but if we look at things like that we will be clutching at straws. The referee had a decent game and if we deal with the corner then there's no problem.
"There are no words anyone can say in a situation like this. It's a horrible feeling and it's difficult but we have to pick ourselves up and move on.
"Football is a business which keeps evolving and we have to go back in on Monday morning and prepare for next season."
Gillingham: Royce, Fuller, Richards, King, Nutter, Lewis, Weston, Wright, Oli, Jackson, Barcham. Subs Not Used: Julian, Bentley, Miller, McCammon, Jarrett.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.