Paris Saint-Germain star Neymar, who had been sidelined with ankle and metatarsal issues since February 25, made his long-awaited comeback as a half-time substitute and took just 24 minutes to net a brilliant strike.
Running onto a pass from Philippe Coutinho, the No.10 turned Croatia defender Sime Vrsaljko this way and that before shifting the ball to his right foot and firing a powerful shot into the roof of the net.
The talismanic 26-year-old looked to have claimed the decisive goal on his return but Liverpool striker Firmino came off the bench to score with an audacious injury-time chip over goalkeeper Danijel Subasic that raised the roof at his home ground.
It was a timely reminder from the pair after Brazil boss Tite had opted to start Coutinho, Gabriel Jesus and Willian at the head of his 4-3-3 system.
And it was the latter of that starting trio who sparked the game into life after nine minutes of prodding and probing in the Merseyside sunshine. The Chelsea forward took possession in midfield and danced through a couple of challenges to drive at the Croatia back four and get the fans off their seats for the first time.
Willian looked to finish the move himself but failed to make the required contact on a low cross from Jesus with a clever flicked finish through his legs.
Croatia responded immediately on the counter-attack. Andrej Kramaric raced onto Luka Modric's lofted pass from midfield but his failure to shoot first time from the right of the box gave Thiago Silva just enough time to recover and expertly snuff out the chance.
Hoffenheim striker Kramaric remained lively throughout a good spell for Croatia - during which Dejan Lovren headed just past the post at the Kop end - and the pair tangled again moments later.
This time Thiago was left clutching his ankle and Kramaric was shown a yellow card as Zlatko Dalic's tough-tackling side perpetrated the first of a flurry of firm challenges on the Brazilians.
Then, it was Coutinho's turn for the spotlight. Midway through the first half, Anfield once again bore witness to two long-range efforts from the returning playmaker, who was making his first appearance in L4 following a January move to FC Barcelona, although both ended up high in the stands.
But it was Willian who looked the dangerman for Brazil, providing a constant outlet ball and terrorising left-back Domagoj Vida when in possession. The No.19 had a curling effort cleared off the line and also stung the hands of goalkeeper Subasic with a left-footed shot before the break.
Croatia boss Dalic started Liverpool centre-back Lovren in his regular place in the heart of defence as the coach cast a final eye over a 27-man preliminary squad he must trim to 23 ahead of the tournament in Russia.
The Reds defender was quickly called into action after the break to block Willian's near-post cross-turned-shot, and Marcelo then fired a long-range daisy-cutter just wide of the post.
Neymar's introduction had led to Tite tinkering with his formation - bringing the forward on for combative midfielder Fernandinho and dropping Coutinho into a deeper role - and the change seemed to give Brazil the edge in a closely contested match.
The substitute made an almost immediate impact as his curling right-footed shot was plucked out of the air by Subasic and then scored the goal that swung momentum in the game.
But the biggest cheer had come on the hour mark when home favourite Firmino was introduced as part of a double substitution. The LFC striker replaced Brazil No.9 Jesus and although he took his time to make his mark on the match, he did so in style.
After firing a shot over the angle of the goal late on, he placed a delightful chip over Subasic to settle the fixture and give Tite a timely reminder of his talent.