Benfica finished its Champions League campaign with a 1-0 win over AEK Athens on Wednesday.
Both teams were out of contention for the knockout stage, and Benfica had already secured third place and a spot in the round of 32 of the Europa League.
Alex Grimaldo scored the winner in the 88th minute with a well-struck free kick over the wall.
"We had a good match, deserved the win," Grimaldo said. "We tried until the end, I am happy that we did it."
Bayern Munich won Group E with 14 points, two more than Ajax. Benfica finished with seven points, while AEK Athens had zero after losing all of its games. Bayern and Ajax drew 3-3 in Amsterdam on Wednesday.
With nothing at stake in Lisbon, both teams took risks in what was an entertaining match at the Stadium of Light. The teams created several chances back-and-forth in the second half, with the hosts coming closest to scoring.
Haris Seferovic hit the crossbar with a header in the 70th, and about 10 minutes later Gedson Fernandes entered the area free from markers but had his shot saved by AEK goalkeeper Vassilis Barkas.
AEK went a man down in the 86th when Kostas Galanopoulos pulled Fernandes' jersey and was shown a second yellow card. Coach Marinos Ouzounidis was sent off a few minutes later after complaining excessively.
"We knew beforehand we were the minnows of our group and unfortunately we were constantly reminded of it in every match," Ouzounidis said.
Benfica had won 3-2 in Greece.