04/02/2013 05:20 EDT | Updated 06/02/2013 05:12 EDT

Barcelona's Messi scores, injures hamstring in tie at PSG; Bayern beats Juventus

PARIS - Lionel Messi scored and injured a hamstring, and Barcelona was held to a 2-2 tie by Paris Saint-Germain in the first leg of their Champions League quarterfinal on Tuesday night when Blaise Matuidi scored for the hosts on the last kick of the game.

Messi's 38th-minute goal, on a left-footed shot following a one-hop flick from Dani Alves, was his 57th of the season and the 59th of his career in the Champions League, second only to Raul Gonzalez's 71.

Xavi Hernandez also scored for Barcelona, and Zlatan Ibrahimovic scored PSG's first goal.

Messi favoured his right leg in the final minutes before the break and was replaced by Cesc Fabregas at the start of the second half. Barcelona said Messi will undergo tests Wednesday on his right hamstring.

"Of course it will be a big loss if we lose Messi, the best player in the world," Barcelona assistant coach Jordi Roura said. "But we have Cesc and other options, so we are confident from that point of view."

In Tuesday's other game, Bayern Munich defeated visiting Juventus 2-0 on goals by David Alaba 25 seconds in and by Thomas Mueller in the 63rd minute. The second legs of the total-goals series are April 10 in Spain. On Wednesday, Malaga hosts Borussia Dortmund and Galatasaray is at Real Madrid.

"Whether or not Messi is there for the return match we will have the same approach," PSG coach Carlo Ancelotti said. "We need to go to Barcelona to score at least two goals, so the attitude will be the same."

Ibrahimovic tied the score in the 79th minute with his 30th goal of the season. Thiago Silva headed Jeremy Menez's free kick off a post, and Ibrahimovic scored against his former team by knocking in the rebound with his left foot from 4 yards in an offside position.

Xavi put Barcelona back ahead in the 89th with a penalty kick awarded by German referee Wolfgang Stark after goalkeeper Salvatore Sirigu tripped Alexis Sanchez.

" The first goal was a gift we gave to Messi. The second was a gift from the referee," Ancelotti said.

Matuidi, who will be suspended for the return leg after getting a yellow card, retied the game in the fourth minute of stoppage time. Christophe Jallet lofted the ball into the penalty area, where Ibrahimovic knocked it down. Matuidi's low shot from 18 yards deflected off Marc Bartra and past the outstretched right arm of diving goalkeeper Victor Valdes.

Barcelona coach Tito Vilanova was back in charge for the first time since returning from a 10-week stay at New York's Memorial Sloan-Kettering Cancer Center following surgery on a saliva gland tumour in Spain in December.

David Beckham started for PSG, and the 37-year-old midfielder was given a yellow card for a late challenge in the 68th minute.

Barcelona's Javier Mascherano left on a stretcher in the 84th with a knee ligament injury. He is suspended for the second leg because of yellow card accumulation.