In the Royal Navy, during the 18th and 19th centuries, an admiral's flagship might have a "captain of the fleet", who would be ranked between the admiral and the ship's captain (or "flag captain"). The "captain of the fleet" would be listed as the ship's "first captain" and would serve as the admiral's chief-of staff. The "flag captain" would be listed as the ship's "second captain" and retain actual command of the vessel.
The United States Navy had a similar position in the nineteenth century, but used the title "fleet captain" instead of "captain of the fleet." The fleet captain was not always actually a captain in rank, for instance Henry H. Bell was a commander when he served as David G. Farragut's fleet captain in the Civil War. In 1869 the Secretary of the Navy ordered that the title of fleet captain be changed to "chief of staff."
Fleet captain has appeared in several science fiction sources, the most notable of which is Star Trek. As a Starfleet officer rank, there have only been two fleet captains shown in the entirety of Star Trek, both from Star Trek: The Original Series: Garth of Izar and Christopher Pike.