Gulf foreign ministers on Thursday agreed on a deal to end months of unprecedented tension between Qatar and other members of the six-nation Gulf Cooperation Council, a statement said.