LONDON—British firms appeared largely unfazed by the prospect of the U.K.’s exit from the European Union, official data showed Friday, with business investment slowing only slightly in the three months following June’s Brexit vote.

The figures add to signs that the U.K. economy held up better than many had anticipated after the referendum, offering...