Messi guided substitute Ibrahim Afellay's cross through the legs of goalkeeper Iker Casillas to open the scoring in the 76th minute.
With three minutes to play, the elusive Argentina forward brilliantly ghosted past three defenders before clipping the ball past Madrid goalkeeper Iker Casillas for his 52nd goal of the season, and 11th in the Champions League.
Barcelona dominated throughout but only managed to break through after Pepe was red-carded in the 61st at the Santiago Bernabeu Stadium.
Madrid coach Jose Mourinho was sent to the stands for protesting the decision, which left Madrid playing with 10 against Barcelona for the fourth straight game.
Mourinho has seen his team finish with 10 players in his last five matches against Barcelona, counting Inter Milan''s 1-0 defeat at Barcelona in the semifinal return leg last year.
"If I say to (the referee) and to UEFA what I think and feel, my career ends today," Mourinho said. "One day I hope to get an answer to the question: why?"
It was Barcelona''s first win in three games between the bitter rivals in 12 days after a 1-1 league draw and a 1-0 extra-time Copa del Rey final defeat.
Madrid''s defense in Tuesday's return leg will be short-handed with Pepe and Sergio Ramos both suspended. Ramos was booked for a foul on Messi in the 53rd minute.
Mourinho described the second leg in Barcelona as "mission impossible" as he continued to bemoan his side''s treatment by the referee. Manchester United looks like the most likely opponent in the May 28 final after winning 2-0 at Schalke on Tuesday.
"We''ll go there with pride, without Pepe who did nothing, without Ramos who did nothing and the coach who can''t be on the bench," he said. "If we score a goal they''ll kill us again. It''s a result that is impossible.
"Today showed we have no possibility. And my question is why? I'll live my whole life with this question but I hope one day to get the answer. Why in a game that was equal did he do what he did? But he won''t answer, he''ll go home because he doesn''t have to answer to anyone."
Counterpart Pep Guardiola refused to respond to Mourinho's comments, preferring to congratulate his team''s performance.
"A team that has nine European Cups never gives up on a series, I'm convinced of that," Guardiola said. "We played a very good game. We controlled their counterattacks, their aerial game which is very dangerous."
Messi's 179th moved him ahead of Josep Samitier to trail only Cesar Rodriguez (235) and Laszlo Kubala (196) in goals scored for the club.
"At 23 he's the third leading scorer in club history. That's incredible," Guardiola said.
Both coaches had stoked tensions on the eve of the match, with Guardiola launching an expletive-filled attack on Mounrinho, and the ill-will spilled over into the match.
Substitute Barcelona ''keeper Jose Manuel Pinto was the first to be sent off for a red card at halftime as the two teams skirmished while leaving the field.
Pinto's sending off left Barcelona without a reserve ''keeper as the frustration of being unable to exploit 70 percent of the possession in the first 45 minutes seemed to boiled over.
Pepe was then harshly sent off after clashing with Daniel Alves as he lunged for a ball and Mourinho was sent to the stands for sarcastically clapping and showing a thumbs up to the fourth official.
"If you know football you know that's not a yellow card," said Madrid winger Cristiano Ronaldo, who was limited to testing Barcelona ''keeper Victor Valdes with a dipping shot before the half and a header over the bar after the restart.
"The coach was set to make changes over the last 20 minutes."
Barcelona dominated possession as expected from the start and Madrid defended while looking for an opportunity to counterattack, which only materialized when Emmanuel Adebayor came on at the start of the second half.
The visitors patiently threaded the ball around and David Villa and Xavi Hernandez nearly put the Catalans ahead with good chances as Madrid clamped down the center with Pepe sticking to Xavi and Messi.
Tensions finally exploded in the 40th when Madrid defender Alvaro Arbeloa was booked after a tussle with Pedro Rodriguez, while Alves was shown a yellow card for a push on Di Maria.
As the second-half minutes ticked down, Madrid looked set to succeed in frustrating Barca, but Pepe's expulsion complicated things.
Mourinho took a seat in the first row behind the dugout and began scribbling instructions that were passed to assistant coach Aitor Karanka, as he looked to reshuffle his team in the absence of his defensive lynchpin.
But there was no stopping Messi, whose second goal was a wonderful example of his trademark darting run and finish.
Apart from hitting out at the officiating, Mourinho also continued his war of words with Guardiola by insisting that if the Catalans coach wins his second Champions League title it will be marred by yesterday's result.