On a bright May morning at Japan’s Idakiso train station, a small cat basked in the sun as her photo was taken by a group of tourists before getting a tummy tickle from a toddler. While the white, tan and black kitten purred and meowed in the arms of a visitor, one of the station workers looked on with a grin, interjecting only to gently reposition the cat’s brimmed conductor hat whenever it threatened to slip over her eyes.

I sometimes forget that she is my boss

“Having her around the station makes everyone happy,” he said, as the cat playfully swiped at a tourist’s iPhone. “I sometimes forget that she is my boss.”

Meet Yontama, the latest in a line of feline stationmasters that has helped save the Kishigawa railway line in Japan’s Wakayama prefecture, a largely mountainous and rural part of the country famous for temple-studded hillsides and sacred pilgrimage trails.

This story began in the late 1990s with a young calico cat called Tama. The kitten lived near Kishi Station – the final of 14 stops on a 14.3km line that connects small communities to Wakayama City, the region’s hub ­– and would frequently hang out by the railway, soaking up affection from commuters.

You may also be interested in:

• The Asian city obsessed with cats

• The cats who rule Rome

• Japan’s ultimate travel food

Over the years, Tama’s sweet nature and photogenic features made her popular with the commuters, and adoring onlookers affectionately began referring to her as Kishi’s ‘stationmaster’. But by the mid-2000s, a combination of low ridership and financial problems threatened to close down the rural rail line, and the line’s 14 stations were finally unstaffed in 2006.

But fortunately, it wasn’t the end for the railway or the beloved feline’s role in it. “In 2006, the current president of the Wakayama Electric Railway, Mitsunobu Kojima, was asked by residents to revive the Kishigawa Line after the previous owner had announced it was to be abolished,” said Keiko Yamaki, an executive for Ryobi, the company that owns the Wakayama Electric Railway. Yamaki explained that the owner of a local convenience store near Kishi Station, who had become Tama’s guardian, had also decided to move on, but before leaving he requested that the railway look after Tama. “Our president has always been a dog person, but when he met Tama that was it,” Yamaki said, while swiping through images on her phone of Kojima happily cuddling the station’s ‘cat master’. “He fell for her.”

In a big way. Soon after adopting Tama, Kojima ordered a customised stationmaster’s hat for his little cat, and in January 2007 he officially named Tama the ‘Stationmaster of Kishi Station’ – the first feline stationmaster in Japan.

As stationmaster, one of Tama’s duties was to be the face of the railway and appear in promotional material and media coverage. She also got paws-on at the station, sometimes greeting passengers from atop a table set up by the ticket gates or from the behind the glass window of her ‘office’ – a converted ticket booth equipped with a litter tray and bed.

Tama was so adored by riders and railway staff that a painted portrait of her was soon commissioned, which now hangs alongside numerous glossy photos of her in Kishi Station’s souvenir shop – where visitors can buy everything from Tama badges and keyrings to Tama-branded candy. In lieu of a ‘salary’, Tama got all the cat food she needed. She received a promotion, too: in 2008, she became a ‘super station manager’ and was even knighted by the prefecture’s governor. In the process, she received a dark blue ceremonial gown with white lace neck ruffles, and thousands of tourists began coming to the small, single-platform station to see her.

In fact, according to a 2008 study by Katsuhiro Miyamoto, professor at Kansai University's School of Accountancy, Tama’s purring presence at the station is estimated to have attracted 55,000 more riders on the Kishigawa Line than were expected in 2007, and during her full reign as stationmaster from 2007 until 2015, she contributed upwards of 1.1bn yen (£7.85m) to the local economy. With the help of its whiskered manager, Wakayama Electric Railway says the annual number of passengers on the Kishigawa Line has increased by almost 300,000 from 2006.

To capitalise on the region’s Tama craze, in 2010 the railway hired award-winning industrial designer Eiji Mitooka – known for his sleek Japanese bullet trains – to completely redesign the train’s exteriors and interiors as a Tama-themed line. The Tamaden railway was born.

In an ode to Tama, the outsides of Tamaden’s two white carriages are now decorated with paw prints and 101 cartoon images of Tama, including Tama enjoying a satisfying stretch, cheerfully licking a paw and mischievously poised to pounce. The front of the train even has little whiskers, while inside are old-fashioned wooden floors and shelves of children’s books. As a finishing touch, when the doors open at each station, a few meows purr through the PA system – an actual recording of Tama.

Having her around the station makes everyone happy

By the time Tama passed away in 2015, she was 16 years old and had appeared in prominent TV shows, magazines and newspapers across Japan. Thousands of people attended her funeral at the station, leaving piles of flower bouquets and cans of tuna outside. The ‘Honourable Eternal Station Master’, as she is now called, was then memorialised with a phone box-sized shrine on Kishi’s platform, and in the Japanese Shinto religious tradition, she was elevated to the status of a goddess of the Wakayama Electric Railway. In honour of what would have been Tama’s 18th birthday in 2017, she even had her own commemorative Google Doodle. And four years after her death, her Twitter account has more than 80,000 followers and is still growing.

“The Tamaden really has become very popular with people of all ages,” Yamaki said. “We see lots of children and families and older people bringing their grandchildren. But also people into trains, couples and lots of overseas travellers come to ride the trains and see the stationmasters.”

Nowadays, one of Tama’s former apprentices, eight-year-old Nitama (literally: ‘Tama Two’), serves as the Kishi stationmaster, with four-year-old Yontama (‘Tama Four’) functioning as her feline assistant five stations away in Idakiso. Both work 10:00 to 16:00 with two days off a week: Monday and Friday for Yontama; Wednesday and Thursday for Nitama. And Tama Three? She’s currently an employee of Japan’s Okayama Electric Tramway and serves as the acting director of the Okaden Museum.

While Tama and her successors have played a major part in the Kishigawa Line’s revival, Yamaki is keen to point out that the railway’s revival hasn’t solely been due to the cats. The railway also hired Mitooka to create several other themed trains to help attract tourists, including a strawberry train (Ichigo Densha) and a pickled plum train (Umeboshi Densha) – both fruits that Wakayama is well known for.

In 2009, Mitooka also designed a new building for Kishi Station, a small thatched structure in the shape of a cat’s head. Little ears stick up from the roof, the entrance serves as a mouth and two oval windows rising from the slanted roof resemble eyes – each glowing yellow when the lights are on in the evenings.

“The station comes alive as a cat when the eyes light up,” Yamaki said. “They say cats ward off evil and misfortune. Maybe the station does.”

Maybe so. After all, throughout history, cats have been considered to be spiritual animals and a symbol of good luck in Japan. The famous Maneki-neko cat figurines, with their beckoning left paw, are said to bring good fortune to businesses, which has led them to be placed inside storefront windows across the globe. There are also shrines and statues across Japan dedicated to cats – such as Nekogami (Cat God) Shrine in Kagoshima, where two cats were enshrined by a feudal warlord in honour of their military service. More than 10 Japanese ‘cat islands’, where hundreds of felines roam free, have become popular tourist destinations; as have Tokyo’s many pay-to-pet cat cafes. And this is to say nothing of Hello Kitty, one of Japan’s most beloved cartoon characters.

In a nation that seems especially fond of felines, Tama and her successors have not only brought plenty of good fortune to the Kishigawa Line, they’ve also carved a place in many Japanese people’s hearts.

But what does Yontama think about it all? She just looked up and sweetly meowed.

Join more than three million BBC Travel fans by liking us on Facebook, or follow us on Twitter and Instagram.

If you liked this story, sign up for the weekly bbc.com features newsletter called "The Essential List". A handpicked selection of stories from BBC Future, Culture, Capital and Travel, delivered to your inbox every Friday.