Neymar scored two goals, including a controversial penalty, as hosts Brazil made a winning start to their World Cup campaign.
The five-time winners trailed when Marcelo’s own goal, after Nikica Jelavic’s miskick, put Croatia ahead.
But Brazil was level when Neymar equalised from 25 yards following Oscar’s powerful run.
Neymar scored from the spot after Dejan Lovren fouled Fred, before Oscar wrapped up victory in stoppage time.
Croatia will feel hard done by, particularly after the controversial penalty decision by Japanese referee Yuichi Nishimura when Fred threw himself to the ground while backing into Lovren.
Meanwhile, the match was preceded with a colourful opening ceremony in front of more than 60, 000 fans in the stadium and billions more watching around the world.
A cast of 660 dancers paid tribute to the country’s nature, people and football with a show around a “living” ball on the Arena de Sao Paulo pitch, reports the BBC.
The final act saw a performance of official World Cup song “We Are One” by Jennifer Lopez and rapper Pitbull.
The month-long tournament sees 32 nations compete in 64 games.
Many fans took to the streets to sing and chant their support for Brazil as excitement built in the hours before the tournament began.
But there were also demonstrations from those unhappy with the expense of hosting the tournament.
Police in Sao Paulo used tear gas to break up one protest, which involved about 50 people, while striking airport workers in Rio de Janeiro blocked a road outside the airport, demanding a wage increase and a World Cup bonus.
The strike was to have lasted for 24 hours but union leaders called it off early for legal reasons.