The origin story of this ancestor of the Martini is shrouded in fog, but it seems that it was developed in San Francisco (near Martinez, CA) in the mid-to-late 1800s, after the Manhattan but before the modern Dry Martini. The basic idea, equal parts vermouth and gin with bitters and a touch of Maraschino, is a clear descendant of the fancy cocktail formula of spirit + triple sec + bitters, except that vermouth adds complexity and Maraschino replaces the triple sec as the sweetening agent.
There's a ton of research on this classic, and a number of recipes have emerged. This version is a commonly-accepted one today, but it should by no means be considered canonical.
I did some careful reseach on this in 2019, during a vacation up the Pacific Coast from LA to Juneau, during which I sampled a number of Martinez cocktails at some very fine bars with knowledgeable mixologists. In fact, that's about the only place that you will find the Martinez, so it's good to know the recipe!
It's still a good drink, especially to play with different gins and vermouths. It's much less alcoholic than a Martini, so it's good to have when you're out, if you're at a bar that has Maraschino. If not, try Triple Sec.