The first Sherlock Holmes story, A Study in Scarlet, was published in 1887.
Arthur Conan Doyle's story introduced both Sherlock Holmes and Dr. John Watson, the partnership at the heart of the Holmes canon. It appeared in the 1887 edition of Beeton's Christmas Annual, making 1887 the correct year for its first publication.
The date can cause confusion because A Study in Scarlet was also issued as a separate book in July 1888 by Ward, Lock & Co. The story's magazine appearance came first, however, so 1888 is not the answer to this question. The novel was followed by The Sign of the Four in 1890.
Doyle wrote the story when he was 27 and working as a doctor in Southsea, Hampshire. Its title refers to Holmes's description of murder as a vivid “scarlet thread” running through the otherwise colourless fabric of life. The story also established Holmes as a consulting detective who applies observation and deduction to criminal problems.