Matias Fernandez's late free-kick ensured Sporting Lisbon claimed a 1-0 win on the night and a 3-2 aggregate success to progress to the last 16 of the Europa League at the expense of Legia Warsaw.
The Portuguese team were heading through on the away goal rule after a 2-2 draw in the first leg in Poland last week, but Fernandez bagged the only goal of the second leg at the Estadio Jose Alvalade to make sure of the result.
The victory earned Ricardo Sa Pinto's side a last-16 date with Premier League leaders Manchester City.
Chances were at a premium in the first half with both sides struggling to create openings.
Fernandez saw his fierce 20-yard free-kick parried by Legia goalkeeper Dusan Kuciak in the 11th minute after Michal Zewlakow had been penalised for handball.
Three minutes later Danijel Ljuboja headed just wide in what proved to be the visitors' best opportunity of the first period.
Kuciak had to be on his toes in the early stages of the second half, tipping over Emiliano Insua's dangerous cross and then punching away an inswinging corner from Fernandez as Sporting pushed for the breakthrough.
Sporting goalkeeper Rui Patricio comfortably saved a left-footed Danijel Ljuboja blast in the 58th minute as Legia too searched for the crucial away goal.
Marcin Komorowski was next to go close for the visitors, heading over the bar from Ivica Vrdoljak's corner midway through the second half, with Rui Patricio then punching away Vrdoljak's free-kick.
There was no way through for Legia, though, and Fernandez made their task significantly more difficult when he put Sporting ahead on the night six minutes from time.
Artur Jedrzejczyk's foul on Diego Capel gave the hosts a free-kick 20 yards out on the left and Fernandez whipped it into the bottom-right corner.
It could have got even better for Sporting two minutes later when Daniel Carrico's free-kick teed up Insua, but he lashed his left-footed effort over the bar.
To their credit, Legia did not give up, and substitute Rafal Wolski almost gave the home fans a nervy ending when he fashioned an opportunity in the final minute. But his right-footed shot was kept out by the feet of Rui Patricio and Sporting got over the line.