Barca snatched the points from a thrilling LaLiga encounter, which finishes 3-2 to the Blaugrana. Messi came on the bench to inspire the comeback, scoring 136 seconds after his introduction.
Ruiz’s own goal then put Barca ahead, before the centre-back headed in at the other end to level things up, but Trincao’s strike resolved the game.
Betis will think as if they did enough to deserve something from the match, but eventually, their five-match unbeaten run has come to an end. Barca meanwhile has now won six away games in a row in LaLiga and are up to second.
Francisco Trincao got the late winner but it was the introduction of Lionel Messi that changed the game.
Without Messi on the pitch, it was 1-0 to Betis and it may well have stayed that way but with him, Barcelona scored three times to take all three points.
Koeman left his best player in the bench ahead of the midweek Spanish Cup semi-final first leg against Sevilla and it did not go well with Borja Iglesias putting Manuel Pellegrini’s side ahead.
Iglesias form flopped last season after making a big-money move from Espanyol. He was on a run of one goal in 32 games five games back but has now scored four in four.
It was one bad enough that a former Espanyol player scored the goal. It was worse than Emerson, who Barcelona own 50 per cent of, the cross-section for him to score.
The attacking right-back on loan at Betis until the end of the season centred low and Iglesias beat Marc Andre ter Stegen to make it 1-0 just before half time.
Barcelona began the second half well with Ousmane Dembele running down the right and crossing for Oscar Mingueza whose shot was nicely saved by Joel Robles. But from a clever pass from Nabil Fekir, Juanma could have doubled the lead.
Koeman had seen enough by the 57th minute and he brought on Messi. Three minutes later Barcelona was level. With nearly his first touch he buried a shot past Joel to make it 1-1 from the edge of the area.
It was now an unusual game with Messi creating more in his first five minutes on the pitch than those he had replaced had managed in the previous hour.
Antoine Griezmann then played Dembele down the right and Joel saved I’m apply again.
On 68 minutes Barcelona were in front. Jordi Alba pulled the ball back to Messi and was able to work in another pass through an eye-of-a-needle hole in the centre of Betis’ defence.
Griezmann got his smart flick all wrong and ended up steering the ball away from goal but it hit Victor Ruiz and crossed the line.
The defender would make up for his error for powering a header past Marc Andre ter Stegen from Fekir’s free-kick on 68 minutes.
Barcelona had lost Ronald Araujo after just 10 minutes. They were now all at sea defensively and Samuel Umtiti was brought on with 12 minutes left in an attempt to shore things up. Loren Moron was one for Iglesias and he almost got the winner for Betis but was denied by Ter Stegen.
There was to be a winner, however. Trincao poked the ball off of Ruiz on the edge of the area and twisted the ball into the top corner for 3-2.
Three points to take into Wednesday’s cup semi-final, when Messi will be on from the start this time.