Ousmane Dembele had put Barcelona ahead in the 40th minute, but the opener was cancelled out 10 minutes later by Nicolo Barella.
Inter then went ahead just after the hour mark through Lautaro Martinez before Lewandowski's first of the night, as Barcelona looked to have found a way back into the game.
They then found themselves behind again inexplicably when Robin Gosens' 89th-minute goal restored the Italian side's lead, but Lewandowski's added-time header would ensure Barcelona's exit from the competition was not confirmed, but was out of their hands.
Elsewhere in Group C, Leon Goretzka scored twice as Bayern Munich stormed to a 4-2 win over Viktoria Plzen.
The Bavarian outfit had found the net four times before the 35-minute mark, with Sadio Mane and Thomas Muller the others to put their names on the scoresheet and - despite two second-half goals from the home side - the result was not in doubt.
Mohamed Salah scored the fastest-ever Champions League hat-trick as Liverpool turned it on in the second half to thrash Rangers 7-1.
Champions League group tables Champions League results Latest Champions League news Get Sky Sports
Scott Arfield had put the home side ahead before Roberto Firmino struck twice and from then on, the result was never in doubt, with Harvey Elliott and Darwin Nunez also finding the back of the Rangers net.
Also in Liverpool's group, Napoli booked their place in the knockout stages with a 4-2 win over Ajax.
Tottenham nervously held on for a 3-2 home win over 10-man Eintracht Frankfurt to go top of Champions League Group D thanks to Heung-Min Son's double.
Frankfurt took the lead, before Son's first-half double either side of a Harry Kane penalty ensured they remained top of the group.
In the other game in Tottenham's group, Marseille beat Sporting Lisbon 2-0.
In Group B, Club Bruges reached the Champions League knockout stage for the first time with a goalless draw at Atletico Madrid.
The Spanish side will have to battle with Porto and Bayer Leverkusen for second place, but Porto went one step ahead with a 3-0 win over the German side.
Correctly predict six scorelines to win £250,000 for free with Super 6. Play for free, entries by 8pm Tuesday.