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.
These two teams hadn't met since Spain won a penalty shootout in the quarterfinals of the 2008 European Championship, propelling Spain to victory in that tournament before going on to win the 2010 World Cup.
Meanwhile, 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. Key playmaker Xavi Hernandez missed the match due to injury.
Perhaps as a consequence of all the absences, 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.
Likewise, Italy manager Cesare Prandelli made a wholesale changes in the forward line in the 59th, removing Antonio Cassano and Giuseppe Rossi for Mario Balotelli and Giampaolo Pazzini.
Many of the fans came to see Cassano, who is from Bari, and usual Italy captain Buffon allowed Cassano to wear the captain's armband for the occasion.
Clearly inspired by his home crowd, Cassano was the catalyst early on for Italy, providing the cross when Criscito hit the post five minutes in from 20 meters (yards).
Criscito then set up the first national team goal for Montolivo, an attacking midfielder who has been linked with a possible move from Fiorentina to AC Milan.
In the 14th, Fernando Llorente replaced Torres, who was accompanied into the changing room by a trainer.
Italy appealed for a penalty went Cassano fell inside the area in the 16th, but the referee ruled that any contact from Gerard Pique wasn't worth a whistle.
Spain didn't pose a threat until the 18th, when Buffon had to scramble to chase a deflected shot that eventually went wide. After the ensuing corner, Buffon collected another shot from Javi Martinez.
Rossi broke through Spain's defense in the 31st but Casillas blocked his angled attempt and Spain then countered with consecutive shots from Andoni Iraola and Santi Cazorla that both sailed high.
Alonso's penalty came after Gioergio Chiellini was whistled for a foul on Llorente.
Three minutes later, Cassano nearly restored Italy's lead with a shot that Casillas deflected just wide, then outjumped a defender for a header that skimmed over the bar in first-half added time.
Cassano is in the process of deciding whether to remain a reserve at AC Milan or transfer to a smaller club to ensure he plays enough to keep his national team spot.
With both sides making numerous changes at the start of the second half, there were no serious scoring chances until Llorente wasted an opportunity in the 60th.
Balotelli then missed high in the 68th and Valdes pushed a free kick from Pirlo wide in the 83rd.
Before kickoff, children from nuclear disaster-hit areas Fukushima, Japan, and Chernobyl were accompanied onto the field by players from both sides.
Having won all five of its matches thus far, Spain resumes Euro 2012 qualifying against Liechtenstein on Sept. 6. Italy, which has a five-point lead in its qualifying group, plays the Faeroes Islands and Slovenia next month.
Italy: Gianluigi Buffon, Christian Maggio, Giorgio Chiellini, Andrea Ranocchia (Leonardo Bonucci, 77), Domenico Criscito, Andrea Pirlo, Thiago Motta (Claudio Marchisio, 46), Daniele De Rossi (Alberto Aquilani, 65), Riccardo Montolivo (Antonio Nocerino, 74), Giuseppe Rossi (Giampaolo Pazzini, 59), Antonio Cassano (Mario Balotelli, 59).
Spain: Iker Casillas (Victor Valdes, 46), Andoni Iraola (Thiago Alcantara, 46), Gerard Pique (Sergio Busquets, 45), Raul Albiol, Alvaro Arberola, Xabi Alonso, Javi Martinez, Andres Iniesta (David Villa, 46), David Silva, Fernando Torres (Fernando Llorente, 14), Santi Cazorla (Juan Manuel Mata, 80).