Sergi Roberto was drafted back in to the Blaugrana line-up, as Sergio Dest dropped to the bench as the only change from last week's win over Athletic Bilbao in the Copa del Rey.
Messi picked up from where he left off in the final after opening the scoring on eight minutes with a curling finish beyond David Soria.
The joy was short-lived as the visitors were back on level terms four minutes later courtesy of an own goal from Clement Lenglet, who turned Angel Rodriguez's cross past Marc-Andre Ter Stegen.
Barcelona were back in front on 28 minutes thanks to an own as well, with Sofian Chakla failure to communicate with Soria saw his back-pass sail into the back of the net.
Koeman's men managed to grab a third goal shortly before the break, with Messi slotting home from a tight angle after his initial strike hit the woodwork.
The visitors were given a lifeline on 69 minutes second-half substitute Enes Unal scored from the penalty spot after he was fouled by Ronald Araujo.
After giving away a penalty at one end, Araujo went from villain to hero in the final three minutes after nodding home a corner from Messi to make it 4-2.
Antoine Griezmann wrapped up the win for the hosts in second-half stoppage time after converting the team's second penalty on the night.