Everything was in the glorious Mediterranean sky here today. Kites fluttered in the gold and green of Brazil and the red, white and green of Italy. Planes pulled bed sheets selling gin. The Goodyear blimp putt-putted along next to the Fuji film blimp.

Highest of all on this raucous, giddy day in which the World Cup took an unexpected turn were Italy's soccer players, 3-2 upset winners to oust mighty Brazil from the tournament.

With an old-man goalkeeper making a sensational save in the 87th minute and with three goals from a kid freshly reinstated after a two-year ban in a gambling scandal, Italy turned the World Cup into all-European semifinals for the first time since 1966.

In a semifinal here Thursday, Italy will go against Poland. A semifinal in Sevilla that night matches France against West Germany.

"This World Cup, anything can happen," said Pele here today after seeing his countrymen denied a chance to add to the three world championships he helped win in 1958, '62 and '70. "Italy surprised everybody today, the way they played."

Fierce on defense in its 2-1 victory over defending champion Argentina two days ago and expected to use the same hand-to-hand holding action against a Brazilian offense romanticized for its verve and creativity, Italy allowed Brazil the choice of weapons today and yet won the duel.

Italy beat Brazil with offense. Had the San Francisco 49ers declined to throw the ball and insisted on winning with defense, the surprise would be no greater than Italy's work today. Not only did the Italians score in the first five minutes, they also scored in the 75th minute, and not for a second did they retreat.

Paolo Rossi, 25, a center forward who says he is innocent of taking a bribe to fix a game, scored the first of three goals on a header off a centering pass from Antonio Cabrino.

This produced a celebration among the Italian fans that included a lighted flare thrown onto the field, where it lay sending up a smoke cloud until someone--100 armed guards ringed the field, police with rifles watched from rooftops and 87 paddy wagons were parked outside--kicked the flare toward the eight-foot high fence keeping the fans in the stands. There the flare caught a banner on fire.

Only 6 1/2 minutes passed before Brazil tied it at 1-1 on Socrates' goal, in which he slipped the ball past the right post as Dino Zoff dived a second late. Zoff, 40, is the oldest man in the tournament. He is playing in his fourth World Cup, and before this day was out he would make up for being a second late by being perfectly on time.

Rossi comes off as a blue-shirted little urchin scurrying among the tall and lean Brazilians in their fabled gold and green. Originally banned from soccer for three years, Rossi's sentence was commuted to two in time to rejoin Italy's team for this tournament. At 1-1 25 minutes into the game, the urchin did what the commuters hoped for. He again scurried away from the big guys.

With a steal at midfield, Rossi sprinted down the right side until he gained a step on a defender, then moved goalward and left keeper Waldir Perez groping as the ball flashed by his left.

Brazil again tied it, 2-2, with 22 minutes to play when Falcao took a routine setup pass from Junior and boomed one past Zoff's right hand from 35 feet out.

This set off an unholy racket from the reported 18,000 Brazilians who flew 10 hours to see their heroes' second-round matches in Barcelona's Sarria Stadium, so small the locals call it "La Bombonera"--the Candy Box. A victory, or even a tie today, would have put Brazil into the semifinal here with a chance at the July 11 final in Madrid.

Italy needed only seven minutes to go back in front. Off a net-mouth scramble on a corner kick, Rossi, who had stationed himself at Perez' side, tapped in his third goal.

At 17 minutes to go and again at seven, Zoff's good work denied Brazil the tie it needed to reach the World Cup semifinals for the fourth straight time.

By then the Brazilians among the 42,000 present had thrown in their tambourines, if not the towel. They came with every noisemaker known to man: tambourines, trombones, cowbells, metal drums and trumpets. Stadium vendors, being helpful, sold them air horns. "Boom-bababoom boom-bababoom", the drums kept saying, while the air horns screamed, "Aiiieeeeee!"

Even with the drums fallen silent, the Brazilians' heroes mounted a furious attack in the last four minutes, especially when an apparent Italian goal was disallowed by an offsides penalty. In the 87th minute, Brazil's Luizinho leaped for a header at the right goal post. The ball deflected downward at a steep angle, and Zoff, flying flat out, smothered it.

But was it over the line and thus a goal? The Brazilians argued it was.

Zoff, in his 104th international game over 13 seasons, said, "It wasn't a goal. I saved it. I know it didn't cross the line."

Fourth in the World Cup in '78 and runner-up in '70, Italy won it all in '34 and '38.It now has a chance to join Brazil as the only three-time winners of the quadrennial tournament that started in 1930.