Barcelona will top Champions League Group H after defeating AC Milan 3-2 in a thrilling game at the San Siro.
With neither side concentrating on defence, the fans were treated to an end-to-end encounter with both sides creating lots of chances.
The Catalan giants had the best of the chances and could have won by a bigger margin if Milan goalkeeper Christian Abbiati had not been in such good form.
Barca went in front after 14 minutes. A move featuring Thiago and Cesc Fabregas led to Seydou Keita busting into the box and when he sent in a low ball from the left, Van Bommel could only divert the ball into the far corner.
Robinho should have equalised in the 19th minute when, after superb work by Ibrahimovic and Boateng, he spooned his first-time effort over Victor Valdes' bar from close range.
Equaliser
The leveller did come moments later. Clarence Seedorf found himself with space on the left and when Ibrahimovic made the run, he found his team-mate with a cute short pass with the outside of his boot. Ibrahimovic made no mistake, nicking the ball under Valdes to put his side level.
Messi hit the bar in the 22nd minute when he beat his marker to Fabregas' low cross from the right but hit his shot off the top of the bar.
Barca were in front again soon after and in somewhat controversial circumstances. Fabregas' lovely ball put Xavi in on goal only for the midfielder to be bundled over by midfielder Alberto Aquilani with referee Wolfgang Stark awarding the spot-kick.
Messi converted the initial kick but was booked and made to take it again after a stuttering run-up foxed Christian Abbiati and he also scored at the second time of asking.
Boateng had a 38th minute effort saved by Valdes when he volleyed Aquilani's diagonal ball at goal.
Carles Puyol joined a growing list of names in Stark's book as the fractured nature of the game continued.
Boateng put Milan level once more early in the second half, taking a loose ball in his stride majestically before blasting it past the bemused Valdes.
Barca took the lead for a third time in the 63rd minute as Messi dissected the Milan defence with knife-like precision to as Xavi timed his run perfectly to prod home.
Thiago's unorthodox free-kick had the Milan defence scrambling as substitute Alexis Sanchez twice failed to put the ball in from close range.