CNN  — 

AC Milan secured its place in this season’s Europa League group stage after scraping past Portuguese opponents Rio Ave in an epic 24-penalty shootout on Thursday.

Goalkeepers Pawel Kieszek and Gianluigi Donnarumma were both among the culprits to miss their spot-kicks as Milan emerged 9-8 winners.

Both sides had scored their first seven penalties, missed their eighth, and then both scored their ninth as tensions began to rise.

There was then a torrid spell with each side missing two consecutive penalties each, including both goalkeepers blazing their attempts over the crossbar.

Milan’s Donnarumma eventually made amends by getting a strong hand to Aderaln Santos’s effort to bring the marathon shootout to a close.

“That is the most epic shoot-out I’ve seen in a long long time,” tweeted Serie A football writer James Horncastle.

READ: Ronaldo pitted against Messi in Champions League group stage

AC Milan advance to the Europa League group stage after beating Rio Ave.

Penalties galore

The game itself was full of drama before reaching its nail-biting conclusion.

Milan had been trailing 2-1 deep into extra-time and, ironically, needed a last-minute penalty to take the tie to a shootout.

Hakan Calhanoglu stepped up to equal the score in the dying seconds of the match after a defender handled the ball in the area.

“It’s a magical night; for us it would have been a shame not to get past this round,” Milan coach Stefano Pioli told reporters after the game.

“This victory gives us strength to keep working and winning.”

The seven-time European champions are still been unbeaten in all competitions since March 8 and will await the Europa League group stage draw on Friday.