Marc Gasol had 32 points and 10 rebounds and Italy beat two-time defending champion Spain 86-81 in overtime at the European basketball championship on Monday.
Italy overcame a 15-point deficit to earn the win, after Luigi Datome made a layup at the buzzer in regulation to force overtime.
Also, Croatia knocked out Greece with a 92-88 victory in double OT.
The loss meant little for Spain, which had qualified for the quarter-finals because of Croatia's victory.
Spain dropped to fourth place in Group F and will play Serbia in the first quarter-final on Wednesday, when host Slovenia faces France.
On Thursday, Croatia plays Ukraine and Lithuania is against Italy.
In another game, Finland beat Slovenia 92-76.
Datome also had key plays in overtime and Alessandro Gentile made four straight free throws to secure Italy's victory. Gentile finished with 25 points.
"We beat probably the best team in the tournament," said Italy guard Pietro Aradori, who had 17 points.
Datome had a block on Victor Claver before making two free throws for an 82-77 Italy lead.
Since winning the silver medal at the 2004 Olympics, Italy has not been able to reach the quarterfinals in any major competition, and failed to qualify for the past two Olympics.
Italy missed the 2009 Europeans as well and finished 17th two years ago.
"This was a good win for my players who had a great desire to play such a game — in the last few years we could see Spain only on TV," Italy coach Simone Pianigiani said.
Spain dropped its third game of the tournament and has looked vulnerable. It has also lost to Slovenia and Greece.
"I thought we had the game under control for three quarters, we defended well and we could run and score easy baskets. But then we broke down, lost our game and they took the momentum into overtime," said Gasol, whose brother Pau is sitting out the event.
Bojan Bogdanovic made two free throws with 18 seconds left to secure Croatia's victory in a tight game. Bogdanovic led all scorers with 22 points.
Greece needed to beat Croatia and hope for Italy to beat Spain and Slovenia to defeat Finland to have any hope of advancing to the quarter-finals.
Croatia aiming for podium
Instead Croatia, which had already secured its spot, made sure of winning Group F.
Croatia is aiming to make the podium at a major tournament for the first time in 18 years.
Greece, champion in 1987 and 2005, had failed to make the last eight only three times since 1987. It never finished lower than sixth when it reached the quarterfinals.
Nikos Zisis made a 3-pointer for Greece with nine seconds left in regulation to tie the game, and then gave his team a 3-point lead with a layup with 36 seconds left in the first overtime. But Bogdanovic hit a 3 to tie the game and Zisis missed a layup that would have won the game.
"That three by Bogdanovic decided the game," Greece coach Andrea Trinchieri said.
By then, Greece was already without its playmaker Vassilis Spanoulis, who fouled out with three minutes remaining in the first overtime.
Zisis missed another game-tying layup in the second OT before Bogdanovic made the free throws that secured Croatia's win.
"We missed two layups to win the game," Trinchieri said.
Centre Yannis Bourousis led Greece with 21 points and nine rebounds, while Spanoulis had 18 points.
"Zisis scored a very tough shot to tie the game. Greece is a very experienced team that can control the rhythm and they did," Croatia coach Jasmin Repesa said.