Romania finished top of Group E as they and Slovakia reached the last 16 at Euro 2024 with an entertaining draw in Frankfurt.
Ondrej Duda gave Slovakia a 24th-minute lead when he got in behind the Romanian defence to power in a header from Juraj Kucka's pinpoint cross.
Both sides showed plenty of attacking intent, and Romania equalised before half-time as Razvan Marin fired a ferocious penalty into the top corner after David Hancko fouled Ianis Hagi in the box.
They finished top, with Belgium second in the group after a draw with Ukraine, who were eliminated.
Slovakia advance as one of the best third-placed sides and could face England in the last 16.
Confirmation of their opponents will come after the final Group F fixtures which take place this evening (20:00 BST).
It was the first time in Euros history that all four teams within a single group have finished on the same points.
Romania reach last 16 for first time in over two decades
Hagi was less than two years old the last time Romania reached the knockout stages of a European Championship, in the summer of 2000.
His clever skill inside the box helped earn him a penalty against Slovakia, and he was lively throughout his 67 minutes on the pitch, firing the rebound over from Andrei Ratiu's curled effort.
Marin's 30-yard free-kick arrowed narrowly wide while Denis Dragus dragged an effort past the post as Romania pushed for a second goal.
Slovakia also pushed for victory with David Strelec's shot from inside the box well saved by the feet of Florin Nita and Lukas Haraslin's low-struck effort curling narrowly wide of the post.
Duda's goal meant he became the first player to score for Slovakia at two major international tournaments, also netting against Wales in Euro 2016.
There was a party atmosphere at full-time for both sets of fans and players as their Euro journeys continued.
Romania boss Edward Iordanescu was pleased that his side made it out of their group in front of plenty of joyful fans.
"I believed in the players from the very beginning. We have potential and personality. We have found the spirit that we must never lose," he said.
"We were losing again but we came back with intelligence, heart and balance. We have written history. This is the generation of soul. It is a fantastic generation.
"Virtually the whole stadium was yellow. Thank you to everyone here and everyone at home in Romania. I'm sure they are all celebrating and will be proud."
Player of the match
After the opportunity to rate players has closed, the score displayed represents the average from all the submissions by BBC Sport users.