Sweden, who at half-time were heading home from Russia, scored three times in the second half to deservedly beat a ragged Mexico 3-0 in Yekaterinburg.
Reigning champions Germany were stunned 2-0 by South Korea in Kazan, bringing a shock early end to their campaign.
Andersson had been infuriated by the celebrations of some of Germany's bench when Toni Kroos scored an injury-time winner last weekend to beat the Swedes 2-1.
He had accused Germany of “rubbing it in our faces”, but he took a more conciliatory approach after his men outmuscled Mexico.
Asked if Germany going home made it an even more satisfying evening, the 55-year-old said: “Never in a million years, you play the game and then wish everyone the best for the next one.
“I am not like that (gloating), it is not like that in sport.”
Andersson added: “I was very angry, but that was then and this is now.”
His opposite number Juan Carlos Osorio said he was “very hurt” and hit out at Sweden's style of football as his side limped into the knockouts.
Mexico were left hoping that Germany did not beat South Korea in the other final group game, as the tension that had bubbled throughout ratcheted up a notch.
As it was, the Mexico fans packed into Yekaterinburg Arena raucously celebrated both South Korean goals and beer rained down when news filtered through that Germany, incredibly, were exiting the tournament.
Sweden and Mexico will next play either Brazil, Switzerland or Serbia from Group E in the knockout round.
Osorio's criticism will be of no concern to Andersson as goals from defenders Ludwig Augustinsson and Andreas Granqvist, from the penalty spot, plus a comical own goal were reward for a physical display.
Sweden only made it to Russia by beating Italy in the play-offs, but were worthy winners at the Yekaterinburg Arena, condemning Mexico's large following to a nervy ending as they became reliant on South Korea in Kazan.
Some of the Mexican fans applauded Sweden afterwards, admission that Andersson's men had taught their side a lesson, albeit one that Osorio has little time for.
For Augustinsson, 24, who plays in Germany for Werder Bremen, it was his first goal for his country and “a dream come true”.
It could have been worse for Mexico, who started badly and never recovered, and Sweden were denied what looked a strong call for a penalty on 30 minutes.
Referee Nestor Pitana of Argentina took a look at a video replay when the ball hit Mexico striker Javier Hernandez on the arm in the box.
After lingering at the pitch-side monitor, then going back for a second glance, Pitana ruled it no penalty — the Mexicans celebrated as if they had scored a goal.
At the interval, with the game also goalless in Kazan, Mexico and Germany were going through.
Sweden needed a goal and five minutes after half-time they got it, Augustinsson popping up from left-back to volley in.
There was more drama on the hour, as Hector Moreno brought down Marcus Berg in the box and skipper Granqvist held his nerve in front of the massed ranks of Mexicans to bury his penalty.
Mexico defender Edson Alvarez compounded a miserable evening with a 74th-minute own goal when he miskicked past goalkeeper Guillermo Ochoa.
That left Mexico in a perilous position, as a late German winner would have sent them crashing out, but two injury-time South Korean goals ensured Osorio's men edged through as runners-up.