Luis Enrique's side have faced criticism for being 'boring' and are yet to win a game so far, but were gifted a goal by Dubravka.
The 2008 and 2012 champions had a golden opportunity to take the lead against Slovakia early on.
After a VAR review, Spain were awarded a penalty as Jakub Hromada fouled Koke in the box.
The Slovakia man tried to clear the ball but Koke got his leg in first and took him out.
Enrique's side had missed their previous four spot kicks, including one earlier in the tournament.
The ball was handed to former Chelsea striker Alvaro Morata… and you can guess what happened next.
A poor penalty was easily saved by Newcastle goalkeeper Martin Dubravka.
Morata has now missed four clear-cut chances at the tournament, more than any other player.
But Spain took the lead in the 29th minute thanks to a calamitous error by Dubravka.
A fierce shot from outside the box rattled the crossbar and went flying into the air.
The Newcastle goalkeeper flapped at the ball and punched it into his own net.
Amazingly, seven own goals have been scored at Euro 2020.
talkSPORT's co-commentator Alvin Martin said: "A comedy of errors and an absolute gift for Spain. Just when you thought good fortune was going to abandon them, they've got a massive lift.
"Dubravka knows it's got to be tipped over, but what on earth he's doing - I do not know. He just palms it into his own net. Crazy!"