In 1705 he served in Spain under Charles Mordaunt, Earl of Peterborough, notably at the Siege of Barcelona and in 1706 he was appointed English minister in Spain, but his duties were still military as well as diplomatic, and in 1708, after some differences with Peterborough, who favoured defensive measures only, he was made commander-in-chief of the British forces in that country.