Jose Luis Rodriguez Zapatero said all proper procedures must be cleared through Parliament before participation in Libya is authorized.
"Before any possible intervention in Libya, we must note the principles to follow, firstly the (approval of the U.N.) Security Council," he said.
Peruvian Foreign Minister Jose Antonio Garcia Belaunde also said a military mission should take place within the framework of the United Nations.
Media reports had earlier reported Spain was planning to seek Arab and African backing for a military operation.
Western powers meet in Brussels Thursday to assess their options for military intervention in Libya, and the European Union will hold an emergency summit on Libya on Friday.