As Hornblower's second ruse is in play, just after Matthews warns him the Spanish suspect something, one line of dialogue makes clear, as the captain of the Spanish ship orders one of his officers: "Señala al almirante. Avisa que vamos a abrir fuego sobre piratas ingleses." Translated: "Signal the admiral. Say we are about to open fire on English pirates".
The Spanish fort used is the prison Peniche Fortress on the central coast of Portugal. As of 2019, it's closed to the public for restoration.
The lines that Kennedy quotes when he wakes up and sees Hornblower and the Duchess are taken from Shakespeare's Antony and Cleopatra (Act4; scene 15). They are spoken by Cleopatra when she realizes Antony has died.
Robert Lindsay played Benedict opposite Cherie Lunghi as Beatrice in the 1984 BBC TV production of Much Ado About Nothing.