The Argentine, who had also scored spot-kicks in wins over Group G opponents Ferencvaros and Juventus, tucked away a penalty in the fifth minute while Gerard Pique netted in the second half, glancing in a fine cross from Ansu Fati.
Dynamo, who were missing six players due to COVID-19 positives, which also afflicted five members of staff, gave a decent account of themselves and spurned a couple of chances to equalise as well as having a goal from a corner ruled out due to the ball going out of play.
They deservedly pulled a late goal back in the 75th minute when Viktor Tsygankov slid the ball into the net, pouncing on a rebound after Barca keeper Marc-Andre ter Stegen could only parry a shot from Benjamin Verbic.
The victory put Barca on the verge of a place in the knockout stages, leaving them top on nine points after three games, with Juventus second on six and Dynamo and Ferencvaros with a point each.
Barca went into the match after a disappointing 1-1 draw at Alaves, the fourth game in a row in La Liga which they had failed to win, but got off to an ideal start at an empty Camp Nou when Messi converted from the spot after being hauled down.
The Catalans made a blistering start and almost immediately built on their advantage when teenager Pedri clanged the crossbar.
Antoine Griezmann then bungled a simple chance to score a tap-in, inexplicably finding the side netting when the ball bounced into his path from close range after Fati saw his shot parried.
Dynamo should have levelled before halftime when Vitaliy Buyalskyi powered a header at goal but was denied by the strong hand of Ter Stegen, who was making his first appearance of the season after recovering from knee surgery.
His opposite number Ruslan Neshcheret, 18, produced an even more impressive display, pulling off an outstanding save from a Messi free kick while also keeping out later efforts from Ousmane Dembele and Sergi Roberto.