Barcelona led when Ferran Torres slid in to meet Marcus Rashford’s fine low ball from the left.
England’s Rashford has scored or assisted a goal in five of Barcelona’s last six games.
But trophy holders PSG – who won a treble last season including French league and cup titles – levelled when Nuno Mendes found Senny Mayulu after a good run and the 19-year-old slotted home.
The visitors, who were missing players through injuries, had the best chances to win the game, and managed to do so with Ramos’ first-time finish from Achraf Hakimi’s cross.
It was the first time an away team had ever scored a last-minute winner in Europe against Barcelona.
“I think we deserved the win,” said substitute Ramos. “We played better than them. We played our game.
“We want to win everything again. We’re not happy with just what we did last season. We want more.”
The result takes PSG to six points from two games, with Barca on three.
Analysis: PSG could be team to beat again

Goncalo Ramos also scored in the final minute of PSG’s 4-0 win over Atalanta
PSG were deserved winners of last season’s Champions League – as part of the treble – when they blew away Inter Milan 5-0 in the final.
Spanish champions Barca had been arguably the most exciting team to watch until their semi-final exit at Inter’s hands.
So many eyes on Wednesday were on the Estadi Olimpic Lluis Companys, which remains Barcelona’s temporary home until the Nou Camp is ready.
Impressively, PSG came away with all three points – despite injuries to their first-choice front three of Khvicha Kvaratskhelia, Ousmane Dembele and Desire Doue, plus captain Marquinhos – while they lost midfielder Joao Neves in the warm-up.
Barca started brightly, with Rashford and Lamine Yamal impressing on the flanks, and got the opening goal.
But former Barcelona boss Luis Enrique’s visiting side showed their class with their lung-busting full-backs assisting both goals.
Mayulu, 19, struck his second Champions League goal – with his first coming in the final in Munich.
PSG had a host of late chances, with Lee Kang-in hitting the post before fellow substitute Ramos bagged the winner.
Player of the match
Average Rating:6.95
Average Rating:6.75
Average Rating:6.74
Average Rating:6.60
Average Rating:6.31
Average Rating:6.19
Average Rating:6.15
Average Rating:6.02
Average Rating:5.94
Average Rating:5.87
Average Rating:5.74
Average Rating:5.53
Average Rating:5.37
Average Rating:5.20
Average Rating:5.15
Average Rating:5.12