Ibiza looked on course for one of the biggest upsets in the history of the competition when Javier Perez's shot deflected in off Pep Caballe in the ninth minute. They could even have doubled their advantage but had a second goal ruled out for a push on Clement Lenglet before Rai Nascimento hit the post.
Griezmann levelled in the 72nd minute and then struck the winner in the fourth minute of stoppage time to book Barca's place in the round-of-16 and spoil the fun for the sell-out crowd of 6,500 on the famous party island.
Barca, the 30-time Copa del Rey winners, are in the hat for the next round. They may have rested Messi, Sergio Busquets and Gerard Pique for this game, but you can't argue they don't take this competition seriously. They have been in the final in each of the last six years, winning the trophy on four occasions.
Griezmann's brace was also timely as Barca look for a replacement for Luis Suarez, who's out for four months. Maybe playing the former Atletico Madrid man through the middle is the answer?
Barca had all the possession in the first half -- over 80 percent -- but didn't register a single shot on target against a side that plays in Spain's regionalised third tier. Griezmann said afterwards that the players are still getting used to what new coach Quique Setien wants. Setien's task is to make sure all that possession isn't sterile.
There were poor performances all over the pitch in the first half, too. Carles Perez failed to take his chance, Junior Firpo struggled while playing out of position and Ivan Rakitic did little to make his case that he should still be at Camp Nou at the end of the month.
Manager rating out of 10
5 -- Setien was brave with his lineup, including Sergi Roberto and Junior in a three-man defence. For all the possession Barcelona had, though, there was little cutting edge.
Player ratings (1-10; 10 = best, players introduced after 70 minutes get no rating)
GK Neto, 6 -- Could not have done much about the goal, which was deflected, and made a smart save from Angel Rodado directly after Ibiza had hit the post at 1-0.
DF Sergi Roberto, 5 -- Played another 90 minutes on the right of a back three, which looks to be his new role under Setien.
DF Clement Lenglet, 5 -- Didn't enjoy his night on the artificial pitch, perhaps because he was the only out-and-out centre-back in the Barca lineup.
DF Junior Firpo, 4 -- Played as part of the back three when he would have preferred to have had one of the wing-back roles he excelled in under Setien at Real Betis.
MF Nelson Semedo, 5 -- This formation should suit him and he looked to attack, but he didn't provide as much in the final third as he would have liked. The Ibiza goal came down his flank.
MF Ivan Rakitic, 4 -- Another below-par display in the middle. Taken off in the final 10 minutes.
MF Frenkie de Jong, 6 -- Not his best performance on his return from suspension but did come up with a match-changing pass, feeding Griezmann for the opener with a great ball.
MF Riqui Puig, 5 -- Played with intent and looked to break the lines with his passing, albeit without much luck. Was caught out for the Ibiza goal, standing still to allow Perez to get in front of him.
MF Ansu Fati, 6 -- Made a lot of bad calls but was a willing runner at the end. Was denied a blatant penalty in stoppage time as Ibiza struggled to deal with his pace.
FW Carles Perez, 4 -- Used to away games like this from his time with Barca B but failed to rise to the occasion here. Made no impact before being withdrawn early in the second half.
FW Antoine Griezmann, 8 -- Emerged as the star of the show after a quiet first half. He kept making the runs and was eventually found, first by De Jong and then, drastically, by Alba in injury time.
MF Jordi Alba, 7 -- Helped swing the game in Barca's favour and set up the winner.
MF Arthur, 6 -- Came on for Puig but didn't have a huge impact on the game other than keeping things ticking over.
MF Arturo Vidal, N/R -- Replaced Rakitic for the final 10 minutes.