Lionel Messi marked his 400th game for Barcelona with a master class of passing by setting up four goals to give Cristian Tello a hat trick in a 4-1 win at Levante in Wednesday's first leg of their Copa del Rey quarterfinal.

Denied by the hosts in the first half, Messi withdrew into midfield to turn playmaker and place four precise passes behind the defence that led to an own goal in the 53rd minute and Tello's treble in the 60th, 81st and 86th.

Levante had held Barcelona to a 1-1 draw at Ciutat de Valencia Stadium just four days earlier in the Spanish league, and it was on course toward a similar feat after Nabil El Zhar netted in the 31st.

But Messi again showed that he is much more than Barcelona's all-time scorer with 331 goals since his debut in 2004 by exploiting Tello's speed down the left flank with well-timed assists.

"It's spectacular to have a player like Messi on your side," said Tello. "All four goals came from his boots."

Elsewhere, Real Sociedad defender Mikel Gonzalez scored twice to help earn a 3-1 victory at home over third-division Racing Santander in their opening leg.

Levante found Barcelona's weak spot in defending set pieces when Carles Puyol's clearance of a free kick fell for El Zhar to score at the second attempt after goalkeeper Jose Pinto had blocked his powerful first shot.

Barcelona was more inspired after the break and Messi's first pass to Tello led to the equalizer. Goalie Javier Jimenez got down to block Tello's shot, but Loukas Vyntra struck the loose ball off teammate Juanfran Garcia and into the net.

Messi again floated back to the centre of the pitch to draw the defence with him before threading another pass to meet Tello's run, and this time the forward fired the ball beyond Jimenez to give Barcelona the lead.

The Argentina star fended off a tackle and slid a diagonal ball for Tello to score his second before Messi picked him out with a pass over the top for his third goal.

"Our first half worried me, but we have players that don't need 45 minutes to turn the match around," Barcelona coach Gerardo Martino said. "[Messi] can change this and any other game. He can undo any type of defence. The tiredness of our rivals played its part and the spaces opened up as they wore down. Leo took great advantage of them."

Puyol had to be replaced by Javier Mascherano in the 57th due to an apparent leg injury. The 35-year-old Puyol has been plagued by a series of injuries for the past two seasons.

Martino, however, said that Puyol's injury was "only a leg knock."

Sociedad forward Gonzalo "Chory" Castro crossed twice for Gonzalez to score his goals, the first coming in the third minute followed by another in the 34th — just two minutes after Racing's Andreu Guerao had hit the crossbar.

Carlos Vela curled in Sociedad's third in the 62nd, but Mahamadou Kone gave Racing hope for next week's return leg by scoring in the 83rd.

Defending champion Atletico Madrid plays Athletic Bilbao on Thursday. Real Madrid won 1-0 at Espanyol on Tuesday.