The visitors had proved tough to break down for the majority of the match, and restricted the Catalan giants to a handful of chances.
Luis Suarez should have broken the deadlock in the first half, but blazed over the bar from close-range.
However, as the game looked destined for stalemate, Messi tapped home the winner after his penalty had been brilliantly saved by Jan Oblak in the Atletico goal.
The tie is still finely poised ahead of the return leg next Wednesday at the Vicente Calderon, with Atletico still very much in with a chance of making the semi-finals.
It was all Barcelona in the opening stages, with Atletico sitting deep in their own half for much of the first 20 minutes.
Neymar forced a fine save from Atletico stand-in ???keeper Oblak from the edge of the box after just five minutes, but aside from that effort, the visitors looked comfortable soaking up the early pressure.
Messi fired over from a tight angle after great work down the right flank, but the Rojiblancos stood firm, with Diego Godin in command at the back.
The chance of the first-half fell to Suarez, who after latching onto a sublime Ivan Rakitic pass blazed over from eight yards. You had to feel the Suarez of last season would have buried the chance.
Atletico rarely threatened in the opening period, but they contained the home side brilliantly, and pressed from the front.
After the interval it was more of the same, with Atletico looking even more resolute.
Fernando Torres was withdrawn at the break, and replaced by Mario Mandzukic, but the Croatian hitman struggled to get involved as Barca continued to dominate possession.
Andreas Iniesta tried his luck from outside the box as the Catalans became more desperate, but Oblak got down well to keep his fierce strike out.
However, as Barca looked to have ran out of ideas, a stroke of luck gifted them the chance to snatch the winner.
After Messi???s free-kick had bobbled around the box, Sergio Busquets was adjudged to have been fouled in the box, and a penalty was given.
Replays showed there was minimal contact, but it seemed justice had been done when Oblak got across to keep Messi???s spot-kick out.
However, the Argentine reacted quickest to prod the ball home, and give Barcelona the slightest of advantages ahead of next week???s second-leg in the Spanish capital.
Elsewhere, a sublime free-kick from Bruno Soriano gave Villareal a 1-0 win over Getafe in their first leg clash at El Madrigal.
Also, Malaga and Athletico Bilbao played out a stalemate in their cup encounter.