Jesus Navas scored in the decisive penalty shot to take his team to the final where the world and European champions will take on hosts Brazil.
Italian defender Leonardo Bonucci was the only player to miss when his shot went high over the bar.
The Confederations Cup final is the fourth major one Spain will figure in five years, having won the 2008 and 2012 editions of the European championship besides the 2010 World Cup.
Italy will face Uruguay in the third-place match in Salvador, also Sunday.
Meanwhile, demonstrations continue to rock Brazil over corruption and poor public services despite a heavy tax burden. Protests are expected during Sunday's final.
Protests are also denouncing the billions of dollars spent to host the FIFA World Cup next year and the 2016 Olympics in Rio de Janeiro.
(with agency inputs)