As an American, I’ve been inculcated with the importance of being happy – or at least pretending to be happy – at all costs. It’s an ethos epitomized by the smiley face emoji, which is said to have been invented in the US in 1963, and empty expressions like “have a nice day”. 

In Portugal, no one tells you to have a nice day. No one particularly cares if you have a nice day, because chances are they’re not having a nice day either. If you ask a Portuguese person how they’re doing, the most enthusiastic reply you can expect is mais ou menos (so so).

Portugal’s culture of melancholy is hard to miss. You see it etched on people’s sombre expressions – this is no Thailand, known as the Land of Smiles – and even in the statues that occupy prime real estate in Lisbon’s public squares. In most countries, the men (and it’s almost always men) honoured in such places are macho generals. In Portugal, it’s moody poets.

Yes, Portugal is a sad land, ranking 93rd of 157 countries (just behind Lebanon), according to the UN’s latest World Happiness Report. But don’t pity the Portuguese. They’re content with their discontentment, and, in an odd but enlightening way, actually enjoy it. It’s easy to assume that the Portuguese are masochists, but if you spend some time here, as I did recently, you quickly realize that the Portuguese have much to teach us about the hidden beauty, and joy, in sadness.

Portugal’s “joyful sadness” is encapsulated in a single word: saudade. No other language has a word quite like it. It is untranslatable, every Portuguese person assured me, before proceeding to translate it.

Saudade is a longing, an ache for a person or place or experience that once brought great pleasure. It is akin to nostalgia but, unlike nostalgia, one can feel saudade for something that’s never happened, and likely never will.

At the heart of saudade lies a yawning sense of absence, of loss. Saudade, writes scholar Aubrey Bell in his book In Portugal, is “a vague and constant desire for something... other than the present.”

It is possible to feel saudade for anything, publisher Jose Prata told me over lunch one day at Lisbon’s bustling Cais do Sodre market. “You can even feel saudade for a chicken,” he said, “but it has to be the right chicken.”

At the heart of saudade lies a yawning sense of absence, of loss

What makes saudade tolerable, pleasant even, is that “it is a very sharable feeling,” Prata explained. “I’m inviting you to share at the table of my sadness.” In Portugal, that’s a big table with room for everyone. In fact, a Portuguese chef has even started a line of chocolate called “Saudade”. Naturally, it is bittersweet.

One day, while sipping an espresso at the Largo de Camões public square in central Lisbon, I met Mariana Miranda, a clinical psychologist. This was the perfect person, I realized, to explain Portugal’s joyful sadness.

Sadness is an important part of life, she told me, adding that she can’t understand why anyone would avoid it.

“I want to feel everything in every possible way. Why paint a painting with only one colour?” By avoiding sadness at all costs, she said, we diminish ourselves. “There is actually lot of beauty in sadness.”

Another day, I met a genial police inspector name Romeu, a friend of a friend. He has happy days and sad days, he said, and he welcomes both equally. In fact, when confronted with an unhappy Portuguese person, he explained, the worst thing you can do is try to cheer him up.

“You’re sad and you want to be sad,” he said. “You’re at the office and people are trying to cheer you up, and you say ‘Don’t make me cheerful. Today is my pleasurable sadness day.’”

Several studies suggest that the Portuguese are onto something. One study, published in 2008 in the Journal of Experimental Social Psychology, found that sadness improves our memory. On gloomy, rainy days, people recalled details (of objects they had seen in a shop) more vividly than on bright sunny days, according to Australian psychologist and lead author Joseph Forgas. Another study in the same journal suggests sadness improves judgment. Participants were asked to watch videotaped statements of people accused of theft and figure out who was lying. The participants experiencing negative emotions at the time were able to more accurately identify the deceptive suspects.

Even sad music has its benefits. Researchers from the Free University of Berlin surveyed 772 people around the world and found that sad music “can actually lead to beneficial emotional effects,” according to the study, published in the journal Plos One. It does this, researchers Stefan Koelsch and Liila Taruffi believe, by enabling people to “regulate” negative moods. Sad music also fires the imagination and evokes “a wide range of complex and partially positive emotions,” they concluded. Interestingly, the positive benefits of sad music were experienced differently among different cultures. For Europeans and North Americans, the strongest emotion that sadness induced was nostalgia, while for Asians it was peacefulness.

No one does sad music like the Portuguese. In particular, fado music is melancholy set to a melody. Fado means literally “destiny” or “fate”, and therein lays its sad beauty. We must accept our fate, even if it’s cruel, especially if it’s cruel.

The genre took root nearly two centuries ago in hardscrabble, working-class neighbourhoods of Lisbon. The first fado singers, or fadistas, were prostitutes and the wives of fishermen who may or may not return from sea. In other words, people on a first-name basis with suffering.

Today, fado is the soundtrack of life in Portugal. You hear it – and feel it – everywhere: on the radio, in concert halls and, most of all, in Lisbon’s several dozen fado houses. One evening, I dropped by one, a tiny place called Duque da Rua, tucked away in the city’s Chiado district. There's nothing slick about this sort of fado house. The singers are mostly amateurs – people like Marco Henriques, who works as an agronomist by day and tends bar in the club in the evening to help make ends meet.

Some fado singers have beautiful, angelic voices, he told me, while others do not. “You can have a bad voice and be a great fado singer,” he said, “because fado comes from the heart.”

Listening to the music, I felt an odd combination of melancholy and relief. Melancholy, because the music was undeniably morose, as were the lyrics, which a Portuguese friend translated for me. Relief, because, for once, I felt no compunction to squelch or deny my sadness. Fado gave me permission to honour my shadow self.

A few days later, in the seaside town of Estoril, 30km southwest of Lisbon, I met Cuca Roseta, a popular fado singer who is one of the few able to earn a living from her music. She prepares for each performance with a minute of silence, a sort of prayer, “before giving myself”, she told me. “This is music where you give yourself. It’s a gift of your emotions and it’s very intimate.”

Roseta represents a new generation of fado singers. The melody is just as melancholic as traditional fado, but the lyrics are subtly optimistic. A sign perhaps that Portugal’s love affair with “joyful sadness” is beginning to wane? I sure hope not.

If you liked this story, sign up for the weekly bbc.com features newsletter, called “If You Only Read 6 Things This Week”. A handpicked selection of stories from BBC Future, Earth, Culture, Capital, Travel and Autos, delivered to your inbox every Friday.