VALENCIA, Spain -- Gareth Bale's late gallop and goal sealed Real Madrid its 19th Copa del Rey title on Wednesday in a thrilling 2-1 win over Barcelona, as the Welshman filled the void left by the injured Cristiano Ronaldo to claim his first career trophy.

Ronaldo's extra-time heroics gave Madrid the 2011 Copa del Rey title at Barcelona's expense, and in his absence Bale scored in the 85th minute to make sure Madrid repeated the feat at the same Mestalla Stadium with his first goal in three "clasico" matches.

Angel Di Maria scored Madrid's opener from a counterattack in the 11th minute of a first half Madrid dominated over a Barcelona side that lacked ideas in attack and was slow to recover in defense.

Barcelona defender Marc Bartra, who was cleared from injury at the last minute, leveled against the run of play in the 67th by heading in from a corner kick to ruin goalkeeper Iker Casilla's record run of not conceding in this edition of the tournament.

The goal energized Barcelona and snapped Lionel Messi into action after an apathetic first hour, and the game's final 15 minutes became a frenetic back-and-forth.

But with the game hanging in the balance, Bale got the winner when he exploded down the left side of the pitch, even running out of bounds to avoid Bartra, before he raced into the area and rolled the ball under goalkeeper Jose Pinto.

Madrid manager Carlo Ancelotti called the goal "surely the most important" of Bale's career, which took a major turn last summer when Madrid broke its own spending record to pay his 100-million euro transfer.

"It was a decisive moment. When Bartra scored anything could have happened," said Ancelotti. "He played well, the entire team played well. You have to play as a compact unit to beat Barcelona."

With Ronaldo out, the focus was on Bale to pick up the slack and he did so in dramatic fashion, unleashing a solo run that proved the worth of his blockbuster price tag.

Barcelona, however, still had one last chance, only for Neymar's shot to hit the upright in the 90th.

"It is difficult to see a player be able to sprint like that at that stage of the game," Barcelona coach Martino said about Bale. "The game was going our way after we had leveled until that counterattack."

Ronaldo joined his teammates to celebrate with their fans on the pitch before the team filed by King Juan Carlos to receive their medals and the prized trophy.