Having been promoted to Major-General on 25 July 1810, Dunlop played a short but important role with Wellington's army during the Peninsular War. Dunlop commanded a brigade in the 5th Division under Lieutenant-General Sir James Leith, who was succeeded briefly by Major-General Sir William Erskine in February 1811. When Erskine was relocated on 7 March, Dunlop took over and thus led the 5th at the Battle of Fuentes de Oñoro, 3–5 May 1811.