Ruth the Betrayer; or, The Female Spy, by Edward Ellis was the first fictional female detective story.
[1] It was published as a penny dreadful in 52 parts in 1862-63[2] by John Dicks, and the British Library's single-volume compilation copy was acquired on 28 February 1863.
[3] It therefore predates Andrew Forrester's The Female Detective and W.S.
Hayward's The Revelations of a Lady Detective, both of 1863/4.
[4] Ruth Trail, the protagonist, is "a female detective – a sort of spy we use in the hanky-panky way when a man would be too clumsy".