Gareth Taylor's team advanced to the quarter-finals with a flawless record in the competition, played in Stockholm where a crowd of 20,248 fans witnessed the match - setting a new record for attendance at a women's club game in Sweden.
City just needed a point to progress, but produced a repeat of the 2-0 victory recorded in last week's reverse fixture where second-half efforts from Laura Blindkilde Brown and Aoba Fujino got the job done.
Shaw overtook Georgia Stanway and Janine Beckie to become City's all-time top scorer in the competition, scoring in either half in Stockholm to take her career tally to seven in the competition.
Ellen Wangerheim cancelled out Shaw's opener at the start of the second half, but Shaw restored City's lead in the 52nd minute and Khiara Keating came up with some key saves to see the game out for City.
TrendingCity, needing only a point to be sure of progressing with two games to spare, responded well to Saturday's 2-0 loss to Chelsea which ended their unbeaten start to the Women's Super League campaign as they maintained their perfect start in the Champions League.
But to do it, they had to overcome both a difficult start to the game and a strong response from the hosts once they had fallen behind. Roared on by another bumper crowd at the Tele2 Arena, Hammarby began brightly.
Former City midfielder Julie Blakstad was proving a particularly tricky customer as she pulled the strings, with Cathinka Tandberg flashing a shot wide early on.
Wangerheim then got in front of Leila Ouahabi to reach a Blakstad cross but stabbed wide from close range.
City had only half-chances in the opening half an hour, but Shaw broke the deadlock with a deflected strike on 32 minutes.
The striker was booked for excessive celebrations by referee Silvia Gasperotti despite appearing to be struck by an object thrown by a section of home supporters.
Blakstad shot just wide as Hammarby tried to level before the break, but instead they had to wait until three minutes after the restart.
Keating was unable to stretch to cut out Blakstad's cross, and Wangerheim was on hand at the back post to turn it in.
Parity lasted only four minutes, however, as Jess Park played in Shaw who fired into the top corner from the edge of the area, her 12th goal in 13 games in all competitions this season.
No sooner had City retaken the lead than Hammarby went close to levelling, but for an outstanding double save from Keating, who denied Tandberg and then jumped to her feet to keep out an even better effort from Blakstad on the follow-up.
City had chances to kill the game off late on. Shaw's cross found the run of Aoba Fujino with 10 minutes to go but the Japan striker's shot was palmed aside for a corner.
At the other end, Keating had to make another big save to keep out Anna Josendal's effort following a corner, diving to her right to stop a powerful strike, and City hung on for another three-point haul.
A number of City players will now depart to join up with their respective nations ahead of the international break. Taylor's side will return to action in the WSL with a clash against Leicester at the Joie Stadium on December 8