Ivan Rakitic converted the decisive spot-kick after Mario Fernandes, who had netted an equaliser for Russian Federation with five minutes of extra-time remaining, hit his effort from 12 yards wide.
The overachieving hosts, the lowest ranked team in the tournament at No. 70, were trying to make it to the World Cup semifinals for the first time since the Soviet Union finished fourth at the 1966 tournament in England.
Still riding the high from his late heroics, Fernandes boldly stepped up to take a penalty in a bid to get his nation to the semi-finals.
Denis Cheryshev scored a brilliant opener in the first half but just eight minutes later former Leicester City striker Andrej Kramarić headed the Croatians level.
It also sets up a clash with England next week for the right to play in the final.
Speaking on RTÉ Television, Hamann said: "They'll be going into the semi-final full of confidence".
Belgium hold off Brazil in thriller to reach semis
The 2018 World Cup may have been the last for several Brazil players, with nine of their 23-man squad in their 30s. They will wait for Brazil to take control of the match but will also have their moments of offensive power .
Brazil elimination 'saddest moment of my career' - Neymar
Against Brazil , it will not be about ball possession, but what you do with it. Information from Reuters was used in this report. I think it will be the match of the tournament".
England target World Cup 2018 semis after Belgium stun Brazil
He was 13 when England last won the World Cup and said he believed this team could achieve the same. Three Lions throwback Sol Campbell opened the scoring against Sweden at the 2002 World Cup.
Fernandes then went from hero to villain, the scorer of the equalizing extra-time goal dragging his penalty kick woefully wide, handing Croatia the advantage.
"We said we can only prove our worth by working hard - I believe not only did people start to trust us, but the entire country of Russian Federation is in love with us, they know what the national team is worth".
Vida was booked moments later after removing his top during his goal celebration.
Subasic made yet another save from the spot, after three against Denmark, to open the shoot out after Fyodor Smolov tried to be too clever. The goal put some life in the otherwise tiresome match. Akinfeev looked to have saved Luka Modric's penalty but it came back off the inside of the post and span back into the net in cruel manner.
Croatia's Dejan Lovren and team mates celebrate winning the penalty shootout.
Ivan Rakitic has waved off Andres Iniesta after the veteran's time at Barcelona although it was his exit from the World Cup that left the Croatian most vexed.