Friday's win took the Spaniards top of Group B and they will now meet hosts Switzerland, while the second-placed Italians meet Group A winners Norway.
Spain finished top of the group with a perfect nine points from their three games, with the Italians second on four points, one ahead of already-eliminated Belgium, who beat Portugal 2-1 to snuff out their chances of advancing.
The swashbuckling football of the Spaniards has singled them out as the team to beat in Switzerland but once more they got off to a sluggish start before saving the day with some outstanding attacking play.
The Italians almost took the lead in the 10th minute when captain Elena Linari smacked a powerful header off the crossbar and seconds later they did score through Elisabetta Oliviero.
Italy worked the ball in from the left flank and Martina Piemonte found enough space to squeeze off a shot that Spain's Mariona Caldente tried to control, but she only succeeded in teeing up Oliviero to slam home the ball.
That jolted Spain into life and they levelled four minutes later as the reigning world and Nations League champions began to dominate possession, Athenea del Castillo working the ball in from the right before playing a brilliant one-two in a tight space with Alexia Putellas and firing into the net.
Patri Guijarro put Spain 2-1 up in the fourth minute of the second half and the Italians struggled to get out of their half for much of the rest of the game, with Esther Gonzalez sealing the deal for Spain with a stoppage-time goal to make it 3-1.
Guijarro declared herself pleased with the business-like way Spain had secured the group win, even if there were things that could be improved.
"I'm happy for the three victories. The match was difficult (but) we are first in the group and now let's go for the quarter-finals," she said.
Spain will take on Switzerland in Bern next Friday, while Italy meet Norway in Geneva on Wednesday.
In Sion, Belgium's Tessa Wullaert and Janice Cayman struck in a dramatic 2-1 victory over Portugal in their final Group B game at Euro 2025 that extinguished the Portuguese team's dreams of advancing to their first European knockout round.
Belgium, who had already been eliminated from quarter-final contention before kick-off, finished third in Group B, while Portugal, who needed a win to advance, were fourth.
Belgium, who had two goals disallowed after VAR checks, had a dream start as Wullaert scored in the third minute after Jill Janssens raced down the right flank before slotting a low cross to the captain. Wullaert steered her shot into the far corner past goalkeeper Patricia Morais.
The Belgians, quarter-finalists in 2022, held strong under an onslaught of desperate Portuguese attacks until Telma Encarnacao bagged an equaliser in the 87th minute to breathe some hope into the Portuguese side.
But Cayman sealed Belgium's victory with a 96th-minute goal that happened largely thanks to terrible Portugal defending, when she pounced on a loose ball and fired home.
Belgium's Mariam Toloba and Amber Tysiak both had goals disallowed in a roller-coaster second half, Toloba for a foul in the build-up and Tysiak for offside.
In Sion, Belgium lost midfielder Jassina Blom, who was carried off on a stretcher in the first half with an apparent knee injury and reappeared later on crutches.