A bizarre blunder by the goalkeeper helped Spain find its scoring touch at the European Championship.

And it also helped them advance to the round of 16.

More Images
Spain's Aymeric Laportem celebrates after scoring his team second goal during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja stadium in Seville, Spain, Wednesday, June 23, 2021. (David Ramos, Pool photo via AP)

A bizarre blunder by the goalkeeper helped Spain find its scoring touch at the European Championship.

Spain's Aymeric Laporte, left, heads the ball to score his side's second goal during the Euro 2020 soccer championship group E match between Spain and Slovakia at La Cartuja stadium in Seville, Wednesday, June 23, 2021. (AP PhotoJose Manuel Vidal, Pool)

Dúbravka saved that early penalty kick from Álvaro Morata but then clumsily knocked the ball into his own net after it ricocheted high into the air off a shot by Pablo Sarabia.

Slovakia's goalkeeper Martin Dubravka makes an own goal, Spain side's first goal, during the Euro 2020 soccer championship group E match between Spain and Slovakia at La Cartuja stadium in Seville, Wednesday, June 23, 2021. (AP PhotoJose Manuel Vidal, Pool)

More AP soccer: https://apnews.com/hub/soccer and https://twitter.com/AP_Sports

Slovakia's goalkeeper Martin Dubravka, center, scores an own-goal while attempting to clear the ball during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja Stadium in Seville, Spain, Wednesday June. 23, 2021. (David Ramos, Pool photo via AP)

Slovakia's goalkeeper Martin Dubravka, center, scores an own-goal while attempting to clear the ball during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja Stadium in Seville, Spain, Wednesday June. 23, 2021. (David Ramos, Pool photo via AP)

Slovakia's goalkeeper Martin Dubravka scores an own-goal while attempting to clear the ball during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja Stadium in Seville, Spain, Wednesday June. 23, 2021. (David Ramos, Pool photo via AP)

Slovakia's goalkeeper Martin Dubravka scores an own-goal while attempting to clear the ball during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja Stadium in Seville, Spain, Wednesday June. 23, 2021. (David Ramos, Pool photo via AP)

Spain players celebrate after Slovakia's goalkeeper Martin Dubravka scored an own-goal, the opening goal during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja Stadium in Seville, Spain, Wednesday June. 23, 2021. (Julio Munoz, Pool Photo via AP)

Spain players celebrate after Slovakia's goalkeeper Martin Dubravka scored an own-goal, the opening goal during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja Stadium in Seville, Spain, Wednesday June. 23, 2021. (Julio Munoz, Pool Photo via AP)

Spain's Aymeric Laportem, center, celebrates after scoring his team second goal during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja stadium in Seville, Spain, Wednesday, June 23, 2021. (David Ramos, Pool photo via AP)

Spain's Aymeric Laportem, center, celebrates after scoring his team second goal during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja stadium in Seville, Spain, Wednesday, June 23, 2021. (David Ramos, Pool photo via AP)

Spain's manager Luis Enrique celebrates after Aymeric Laporte,scored his side's second goal during the Euro 2020 soccer championship group E match between Spain and Slovakia at La Cartuja stadium in Seville, Wednesday, June 23, 2021. (AP PhotoJose Manuel Vidal, Pool)

Spain's manager Luis Enrique celebrates after Aymeric Laporte,scored his side's second goal during the Euro 2020 soccer championship group E match between Spain and Slovakia at La Cartuja stadium in Seville, Wednesday, June 23, 2021. (AP PhotoJose Manuel Vidal, Pool)

An embarrassing own-goal by goalkeeper Martin Dúbravka in the first half put Spain on the way to a 5-0 victory Wednesday, and it came only minutes after the host team had missed another penalty and wasted more scoring chances.

Spain's Aymeric Laportem celebrates after scoring his team second goal during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja stadium in Seville, Spain, Wednesday, June 23, 2021. (David Ramos, Pool photo via AP)

Spain's Aymeric Laportem celebrates after scoring his team second goal during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja stadium in Seville, Spain, Wednesday, June 23, 2021. (David Ramos, Pool photo via AP)

Dúbravka saved that early penalty kick from Álvaro Morata but then clumsily knocked the ball into his own net after it ricocheted high into the air off a shot by Pablo Sarabia.

Aymeric Laporte added to Spain’s lead before halftime, and Sarabia, Ferran Torres and another own-goal in the second half made it five for “La Roja,” which had been facing elimination in front of its fans.

The victory allowed Spain to advance in second place in Group E with five points, two fewer than Sweden, which defeated Poland 3-2 in the other match. The result eliminated Slovakia, which needed a draw to guarantee its place in the next round.

Spain's Aymeric Laporte, left, heads the ball to score his side's second goal during the Euro 2020 soccer championship group E match between Spain and Slovakia at La Cartuja stadium in Seville, Wednesday, June 23, 2021. (AP PhotoJose Manuel Vidal, Pool)

Spain's Aymeric Laporte, left, heads the ball to score his side's second goal during the Euro 2020 soccer championship group E match between Spain and Slovakia at La Cartuja stadium in Seville, Wednesday, June 23, 2021. (AP PhotoJose Manuel Vidal, Pool)

More AP soccer: https://apnews.com/hub/soccer and https://twitter.com/AP_Sports

Tales Azzoni on Twitter: http://twitter.com/tazzoni

Slovakia's goalkeeper Martin Dubravka makes an own goal, Spain side's first goal, during the Euro 2020 soccer championship group E match between Spain and Slovakia at La Cartuja stadium in Seville, Wednesday, June 23, 2021. (AP PhotoJose Manuel Vidal, Pool)

Slovakia's goalkeeper Martin Dubravka makes an own goal, Spain side's first goal, during the Euro 2020 soccer championship group E match between Spain and Slovakia at La Cartuja stadium in Seville, Wednesday, June 23, 2021. (AP PhotoJose Manuel Vidal, Pool)

Slovakia's goalkeeper Martin Dubravka, center, scores an own-goal while attempting to clear the ball during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja Stadium in Seville, Spain, Wednesday June. 23, 2021. (David Ramos, Pool photo via AP)

Slovakia's goalkeeper Martin Dubravka, center, scores an own-goal while attempting to clear the ball during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja Stadium in Seville, Spain, Wednesday June. 23, 2021. (David Ramos, Pool photo via AP)

Slovakia's goalkeeper Martin Dubravka scores an own-goal while attempting to clear the ball during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja Stadium in Seville, Spain, Wednesday June. 23, 2021. (David Ramos, Pool photo via AP)

Slovakia's goalkeeper Martin Dubravka scores an own-goal while attempting to clear the ball during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja Stadium in Seville, Spain, Wednesday June. 23, 2021. (David Ramos, Pool photo via AP)

Spain players celebrate after Slovakia's goalkeeper Martin Dubravka scored an own-goal, the opening goal during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja Stadium in Seville, Spain, Wednesday June. 23, 2021. (Julio Munoz, Pool Photo via AP)

Spain players celebrate after Slovakia's goalkeeper Martin Dubravka scored an own-goal, the opening goal during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja Stadium in Seville, Spain, Wednesday June. 23, 2021. (Julio Munoz, Pool Photo via AP)

Spain's Aymeric Laportem, center, celebrates after scoring his team second goal during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja stadium in Seville, Spain, Wednesday, June 23, 2021. (David Ramos, Pool photo via AP)

Spain's Aymeric Laportem, center, celebrates after scoring his team second goal during the Euro 2020 soccer championship group E match between Slovakia and Spain at La Cartuja stadium in Seville, Spain, Wednesday, June 23, 2021. (David Ramos, Pool photo via AP)

Spain's manager Luis Enrique celebrates after Aymeric Laporte,scored his side's second goal during the Euro 2020 soccer championship group E match between Spain and Slovakia at La Cartuja stadium in Seville, Wednesday, June 23, 2021. (AP PhotoJose Manuel Vidal, Pool)

Spain's manager Luis Enrique celebrates after Aymeric Laporte,scored his side's second goal during the Euro 2020 soccer championship group E match between Spain and Slovakia at La Cartuja stadium in Seville, Wednesday, June 23, 2021. (AP PhotoJose Manuel Vidal, Pool)