White House says Spain agreed to cooperate with U.S. military operations after Trump threatened to cut off trade.