Edin Dzeko scored twice as Inter booked their place in the last 16, joining Bayern Munich in qualifying from Group C, with five-time European champions Barca having to settle for a Europa League place.
Henrikh Mkhitaryan opened the scoring for the home side in the 35th minute from an Alessandro Bastoni cross, before Dzeko had his first of the night with a tap-in at the far post, converting from a well-timed ball from Federico Dimarco.
Dzeko added his second in the 66th minute and Romelu Lukaku capped off Inter's night with the fourth.
Barcelona went on to lose 3-0 at home to Group C winners Bayern Munich.
The Bundesliga outfit got off to a good start when Sadio Mane opened the scoring in the 10th minute.
Eric Choupo-Moting added a second before half-time, with Benjamin Pavard completing the scoring in the fifth minute of stoppage time.
Napoli need a draw against Liverpool next week to win Group A after beating Rangers 3-0.
Giovanni Simeone scored twice in the first 16 minutes before Leo Ostigard sealed victory with an 80th-minute header.
Liverpool qualified for the last 16 after beating Ajax 3-0.
Mohamed Salah, Darwin Nunez and Harvey Elliott all found the net, after Liverpool had an early scare when Ajax's Steven Berghuis hit the woodwork.
In Group D, Harry Kane's last-gasp winner was ruled out by VAR to leave Tottenham's hopes of reaching the last 16 in the balance after a 1-1 draw against Sporting Lisbon.
Spurs thought they had won the match when Kane found the back of the net but after a long VAR review, it was ruled out for offside.
Former Spurs youth player Marcus Edwards put the visitors ahead, but it was cancelled out by Rodrigo Bentacur 10 minutes from time.
In the other game in Group D, Eintracht Frankfurt secured a 2-1 home victory over Marseille, with all clubs still able to qualify.
Diogo Costa saved two penalties as Porto beat Club Bruges 4-0.
Also in Group B, Atletico Madrid missed a last-gasp penalty as they crashed out following a 2-2 draw with Bayer Leverkusen.
Lukas Hradecky saved from Yannick Carrasco from 12 yards, the follow-up was headed onto the crossbar and a third chance deflected over to leave both sides fighting for a Europa League spot.