Athletic got off to a dream start in their first match under new coach Marcelino when forward Inaki Williams latched on to a low through ball and raced towards goal, beating one defender before firing low into the net in the third minute.
Barca quickly responded, however, with a sensational team goal, Messi delivering a superb pass to pick out Frenkie de Jong by the byline and the Dutchman volleyed the ball back across the area for 18-year-old Pedri to head home.
Messi and Pedri combined beautifully to put Barca ahead, the youngster receiving a pass from the Argentine before returning it with a delightful backheel and Messi rolled the ball into the bottom corner in the 38th minute.
Messi struck again in the 62nd minute to finish off another brilliant team move and missed a couple of chances to complete his hat-trick, although Iker Muniain made for a tense finale by scoring for Athletic in the 90th.
"When you concede so early it's normal to drop your heads but we showed a lot of self-belief to make sure that didn't happen," said Pedri.
"We knew it was an important game that's how we approached it, we knew they'd look for Inaki with his speed but we overcame that and got three very important points."
The win led Barca boss Ronaldo Koeman to reassess previous pessimistic comments about his side's faint chances of catching Atletico.
"That's the way we need to continue. I felt like we controlled the game the whole time and there were barely any dips in our play," Koeman told a news conference.
"The title race is still open because the season is very long. There can be injuries, teams can have downturns and a side that looks very good can end up struggling," he said.
Messi has had a relatively poor season by his own standards but his scores took him on to nine goals for the campaign, making him the joint top scorer in La Liga.
"Messi has given everything since day one, he has spent so many years at the very top level but it seems that now he has become even more effective," Koeman said. "He has always shown us his skill and his commitment but today he gave us his goals too."
On Pedri, Koeman added: "He plays with so much maturity despite his age and most importantly he uses his head."
Athletic forward Williams said his side had played well but were powerless to stop Barca when Messi was on top form.
"We played a good first half, we were the Athletic we wanted to be but we were up against the best player in the world and he swung the game in a different direction," he said.
"The goals they scored tonight were fantastic and there's very little you can do to defend against plays like that."