Mystery writer Sue Grafton — who penned whodunits starting with nearly every letter of the alphabet — died after a two-year battle with cancer, loved ones said Friday. The “Alphabet Mysteries” author was 77.

“Although we knew this was coming, it was unexpected and fast,” daughter Jamie Clark wrote on her mom’s Facebook page.

“She had been fine up until just a few days ago, and then things moved quickly.”

Granton published “A is for Alibi” in 1982 and came out with “Y is for Yesterday” this past August.

Grafton hadn’t yet hatched an idea for Z — and her literary heroine Kinsey Millhone — when the author died surrounded by family Thursday in Santa Barbara, Calif.

“Because of all of those things, and out of the deep abiding love and respect for our dear sweet Sue, as far as we in the family are concerned, the alphabet now ends at Y,” Clark wrote.

She’s also survived by daughter Leslie Twine, son Jay Schmidt and husband Steven Humphrey.

Grafton will be cremated before memorials are staged in New York and her native Louisville, Ky.

With Wires