The youngster started on the bench on Saturday as Xavi rotated his line-up ahead of a busy week, but the playmaker replaced the injured Ousmane Dembele in the 25th minute.
Girona stymied the league front-runners until Pedri's fellow substitute, Jordi Alba, found him with a low cross at close range in the 61st.
Pedri, who won the 2021 Golden Boy award as the continent's most promising under-21 player, is considered one of the pillars of Barcelona's post-Messi rebuild, the Spain midfielder having already scored six times this season.
Xavi's team have for the moment moved six points clear of Real Madrid before the title holders host third-placed Real Sociedad on Sunday at the LaLiga's midway point.
Dembele asked to be substituted after he was apparently bothered by his left thigh following a sprint.
The France forward, who suffered a series of injuries in his first seasons with Barcelona, has avoided serious injury since returning from a knee issue in November 2021 and became one of the club's leading players.
His departure left Barcelona without their top two scorers. Robert Lewandowski, who leads the league with 13 goals, was completing a three-game suspension, while Ferran Torres was also suspended.
Girona coach Michel was sent off in stoppage time with a direct red card for vehemently protesting what he thought was a foul on one of his players.