Early details of postal arrangements in Gibraltar are hard to establish although it is known that postal facilities were provided by the Civil Secretary’s Office from 1749. Gibraltar became a packet port in July 1806 (a year after the Battle of Trafalgar in 1805), although the Civil Secretary’s office continued to be responsible for other mail. The two services were amalgamated on 1st January 1857 as a Branch Office of the British Post Office with the control of the Gibraltar Post Office not reverting to Gibraltar until the 1st January 1886.
Spanish stamps could be used in Gibraltar from their introduction in 1850 and indeed such franking was required on letters . . .
Full story at: Gibraltar Philatelic Bureau