Back with Liverpool after a season on loan at Juventus, Aquilani's decisive shot was deflected in by Spain defender Raul Albiol in the 84th minute.
Domenico Criscito also hit the post for Italy on a windy evening before a crowd of 50,000 at San Nicola stadium.
''If we want to be fair, a draw would have probably been appropriate,'' Italy coach Cesare Prandelli said. ''We certainly had an advantage in the first half, but Spain played better in the second half.''
Italy hadn't beaten Spain since also winning 2-1 in the quarterfinals of the 1994 World Cup. Spain won the last meeting in a penalty shootout in the quarterfinals of the 2008 European Championship, propelling the Iberians to victory in that tournament before going on to win the 2010 World Cup.
The Azzurri are now rebuilding after an embarrassing first-round exit from last year's World Cup.
''We're on the right road,'' Prandelli said. ''This is a young team and when we perform like this against great teams our self-confidence improves.''
Spain coach Vicente del Bosque kept standout striker David Villa on the bench until the start of the second half, and center forward Fernando Torres came off with a slight concussion after just 14 minutes. Also, key playmaker Xavi Hernandez missed the match due to injury.
''I'm satisfied with our performance,'' Del Bosque said. ''I don't have anything to criticize the players over.'' Spain rarely settled into its mesmerizing short-passing game; and Del Bosque reinforced that the match was merely a friendly by taking out Casillas for Victor Valdes to start the second half.
''When you play matches like these, you always want to win,'' Casillas said. ''It was only a friendly up until a certain point. The problem was that this was the first time a lot of us had played together after a long time and we're at the start of the season.''
Likewise, Italy manager Cesare Prandelli made wholesale changes in the forward line in the 59th, removing Antonio Cassano and Giuseppe Rossi for Mario Balotelli and Giampaolo Pazzini.