Knockout-phase debutants City matched Barcelona in the first half at the Etihad Stadium, but the game changed early in the second period when Martin Demichelis was sent off following a last-man foul on Messi.
The Argentine scored from the ensuing penalty in the 54th minute, taking his tally of goals in this season's competition to seven.
Despite being a man down, City continued to threaten, but in the final minute Alves ran through to score, leaving Barcelona firmly in the driving seat ahead of the return leg on March 12.
"I'm happy with the result," said Barcelona manager Gerardo Martino.
"We've played very well in the first 90 minutes, but I say 90 minutes because the tie will last 180 minutes. We'll play the second leg as if the score is 0-0."
City manager Manuel Pellegrini strongly criticised referee Jonas Eriksson, claiming that Sergio Busquets should have been penalised for a foul on Jesus Navas in the build-up to the penalty and that Demichelis's foul on Messi had occurred outside the box.
"I think that the referee decided the game," he said.
"Before the penalty there was the foul on Navas, when he (Eriksson) was three metres from the player, so he saw it without any problem.
"From the beginning I felt that the referee was not impartial to both teams. The penalty on Martin Demichelis was not a penalty -- it was outside the box."
While Neymar started on the bench for Barcelona after his recent return from injury, Pellegrini sent City out in a pragmatic 4-4-1-1 formation, with Alvaro Negredo playing as a lone striker.
Both managers had emphasised the importance of possession before the game and in that domain the visitors quickly stamped their authority, immediately trading passes with their usual hypnotic fluidity.
There was no penetration to their passing, however, and when City began to probe, they found fissures in the Barca defence.
A pass from David Silva freed Negredo, who eluded Gerard Pique before lifting the ball over Victor Valdes from a tight angle, but there were no City players up in support.
Barca goalkeeper Valdes was then given a moment of discomfort when Vincent Kompany got his head to a free-kick from Silva, sparking a goalmouth scramble that was cut short when Negredo was penalised for an infringement.
Negredo hit a snapshot straight at Valdes, before Barca came to life, with Messi firing over from the edge of the box and Xavi extending City goalkeeper Joe Hart with a rasping 25-yard drive.
It was an encouraging first half for the home side, but eight minutes into the second period the balance of the tie suddenly shifted in Barcelona's favour.
Andres Iniesta's pass put Messi through on goal and Demichelis, sliding in from behind, brought the Argentine down.
The offence occurred right on the edge of the box, but referee Eriksson awarded a penalty and after Demichelis had trudged off, Messi planted the spot-kick past Hart.
Pellegrini sent on Joleon Lescott and Samir Nasri in place of Aleksandar Kolarov and Navas, and Nasri quickly had a sight of goal, only for Pique to block.
Alves teed up Xavi to shoot over and then drilled narrowly wide after a one-two with Alexis Sanchez as Barca threatened to twist the knife, while Neymar's introduction seemed to presage further bad news for City.
Instead, the hosts continued to push, with Valdes plunging to his right to repel a volley from Silva in the 77th minute.
Barca had the final say, however, with Alves gathering a pass from Neymar and tucking the ball between Hart's legs in the final minute to further tighten the Catalans' grip on the tie.