BARCELONA, Spain — Pedro Rodriguez and Daniel Alves scored first-half goals, and Barcelona held off a spirited Real Madrid comeback attempt to eliminate the defending Copa del Rey champion with a 2-2 tie Wednesday night.

Following the ninth clasico between the rivals in nine months, Barcelona advanced to the semifinals on 4-3 aggregate and next plays Valencia or Levante.

Pedro entered in the 30th minute after Andres Iniesta limped off and put Barcelona ahead in the 43rd off a pass from Lionel Messi, who had drawn three defenders.

Barcelona doubled the lead in the 48th when a free kick by Xavi Hernandez, who was celebrating his 32nd birthday, went off Lassana Diarra and into the path of Alves, who sent a shot into the top far corner past the outstretched Iker Casillas.

Cristiano Ronaldo started the rally attempt in the 68th with his 30th goal of the season, running onto Mesut Oezil's through ball and rounding goalkeeper Jose Manuel Pinto. Substitute Karim Benzema tied the score in 73rd.

Madrid defender Sergio Ramos was ejected in the 88th minute for his second yellow card, and Madrid coach Jose Mourinho left Camp Nou winless in nine visits.

"We played a great team, this is a 'clasico' so you know right up to the end you're going to have to suffer and hold off your rival," Alves said. "They caused us a lot of problems by pressuring high, but we knew how to respond."

Mourinho used a more offensive starting lineup than last week and opted to include defender Pepe, who was jeered loudly on every touch after stomping on Messi's hand in the first leg.

Mourinho was criticized after his tactics last week, causing some to question his future with Madrid.

Madrid was unlucky over the first half hour as Oezil hit the crossbar with a superb 30-yard effort, and Pinto made several point-blank stops on Gonzalo Higuain.

Madrid had a Sergio Ramos goal waived off in the 54th for a foul.

Earlier Wednesday, Athletic Bilbao beat Mallorca 1-0 to win on 3-0 aggregate, advancing to a semifinal against third-tier Mirandes. Valencia has a 4-1 lead going into Thursday's match at Levante.