Messi netted from the penalty spot to give Barca the lead after he was felled at the end of a weaving run.
Ansu Fati volleyed Barca’s second, with Philippe Coutinho adding a third.
Gerard Pique was sent off for a foul that set up Ihor Kharatin to narrow the deficit from the penalty spot, but Pedri and Dembele ensured Barca’s win.
Pique’s dismissal is a costly one for the Spanish side, with the experienced defender now suspended for their trip to Italian champions Juventus in gameweek two.
But Barca will be lifted by Pedri’s low finish, with the teenager already starting to draw attention to himself after just a handful of appearances for the club.