BARCELONA, Spain -- Lionel Messi scored on his 15th straight start to seal a thrilling 4-2 win for Barcelona at Malaga on Thursday, sending the defending champions through to a Copa del Rey semifinal against archrival Real Madrid.
Barcelona broke a rare two-game winless streak by outgunning Malaga to reach its sixth semifinal in seven years with a 6-4 victory on aggregate.
At 2-2, the game was heading for extra time when Andres Iniesta combined with Cesc Fabregas to score in the 76th minute. Messi then headed Barcelona's fourth and his 40th goal of the season just four minutes later.
"We knew it would be difficult coming in here in need of a win," said Barcelona defender Gerard Pique, who also scored for the visitors. "The result is fair, even though they played a great game."
This will be the third straight year that Barcelona and Madrid meet in the Copa. Madrid beat Barcelona in the 2011 final, while Barcelona knocked Madrid out of the quarterfinals last season on its way to claiming a record 26th cup title.
Earlier, Atletico Madrid eliminated Real Betis 3-1 on aggregate to reach the other semifinal with Sevilla.
The first half was electric at La Rosaleda stadium. Both teams pressed aggressively and attacked in waves, and the poor pitch only added extra drama with players constantly slipping and sliding on the thin grass.
Barcelona struck first in the eighth minute. Xavi Hernandez played Dani Alves wide on the right, and the Brazil fullback just beat the offside trap before picking out Pedro Rodriguez for a header into the corner of the net.
Joaquin Sanchez replied for the hosts four minutes later when he received Sergio "Duda" Barbosa's pass on the break and placed a low shot just inside the post to beat diving goalkeeper Jose Pinto.
Messi came close to doing it all alone in the 25th when he intercepted a pass and charged into the area, but Malaga goalie Carlos Kameni was up to the challenge and smothered his point-blank strike.
Even with the away-goal advantage, Malaga continued to push forward and Roque Santa Cruz stabbed a free kick wide in the 36th, moments before Messi played Andres Iniesta through, only to see his shot clip the crossbar.
Barcelona wove together some breathtaking combinations looking to hit back before the break, but Malaga's defence resisted until a well-deserved breather at the break.
Pique swung the tie back in Barcelona's favour in the 50th when he showed the touch of a striker by controlling Iniesta's lobbed pass with his chest before sweeping the ball in with his left foot. The Spain defender celebrated his goal by sucking his thumb for his baby boy born on Tuesday to pop singer Shakira.
Malaga couldn't keep up the same level of intensity from the first 45 minutes, and Barcelona slowly extended its control.
But just when Barcelona was playing its best, Malaga gathered itself to launch a counterattack that Joaquin capped by passing for Santa Cruz to fire in off the far post and make it 4-4 on aggregate in the 67th minute.
Barcelona, however, wasn't fazed and Iniesta struck the decisive goal with an elegant slalom to get by Malaga's first line of defence, before working a one-two with Fabregas that left him clear to slot under Kameni.
Messi then hit the 40-goal mark for the fourth consecutive season when he turned Dani Alves' cross home.
The Argentina forward was substituted shortly after for the first time since Jan. 12, 2011.
Atletico drew 1-1 at Real Betis with Diego Costa scoring for Atletico in the 45th and Jorge Molina earning and converting a penalty to level one minutes from time.
The semifinals begin next week, with the second leg matches following in late February.