The novel is set at the turn of the 19th century. It follows the young Jack Aubrey who has just been promoted to the rank of Master and Commander, and Stephen Maturin, a destitute physician and naturalist whom Aubrey appoints as his naval surgeon. They sail in HM Sloop of War "Sophie" with first lieutenant James Dillon, a wealthy and aristocratic Irishman. The naval action in the Mediterranean is closely based on the real-life exploits of Lord Cochrane, including a battle modelled after Cochrane's spectacular victory in the brig HMS "Speedy" over the vastly superior Spanish frigate "El Gamo". The novel puts the reader into the times in every aspect, from the ways of the Royal Navy on sailing ships to the state of science and medicine and social status.