The match will be held in either Austria or Switzerland on 30 May, the Korea Football Association (KFA) told AFP on Thursday.
KFA chief Cho Chung-Yun met his Spanish counterpart Angel Maria Villar in Switzerland on Tuesday and reached agreement on the fixture, it said.
South Korea and Spain met in Austria before the 2010 FIFA World Cup in South Africa and Spain won 1-0. Spain, who won Euro 2008 and the 2010 FIFA World Cup, will launch their European Championships title defence in June.
South Korea, who have reached the FIFA World Cup eight times, play Qatar on 8 June, their first match in the final Asian qualification round for Brazil 2014.
Coach Choi Kang-Hee said a tough friendly against the world champions would help his team prepare. He said he would call up more players from Europe for the friendly because of a tight K-League schedule.
But Choi was cautious over whether to select Arsenal forward Park Chu-Young, citing a controversy over postponement of his military service, which has sparked an angry response from fans. "It weighs on my mind as I have to consider public sentiment," he said.
Park said through representatives this month that he was legally exempt from military service until 2022 thanks to a 10-year residence visa for Monaco. He promised to return before he turns 35 to serve his country.
Fans have expressed concern that Park has set a poor example for others facing compulsory call-up for military service.