The foreign secretary will meet Spanish and Brussels counterparts later to try and finalise a deal.