The study analysed over a billion anonymised status updates among more than 100 million users of Facebook in the US.
Positive posts beget positive posts, the study found, and negative posts beget negative ones, with the positive posts being more influential, or more contagious.
"Our study suggests that people are not just choosing other people like themselves to associate with but actually causing their friends' emotional expressions to change," said lead author James Fowler, from the University of California, San Diego.
There is abundant scientific literature on how emotion can spread among people - through direct contact, in person - not only among friends but also among strangers or near-strangers.
Also Read
Little is known, though, about emotional contagion in online social networks. Yet, in our digitally connected world, it is important to learn what can be transmitted through social media, too, Fowler said.
Researchers analysed anonymous English-language status updates on Facebook in the top 100 most populous cities in the US over 1,180 days, between January 2009 and March 2012.
Researchers relied on automated text analysis, through a software programme called the Linguistic Inquiry Word Count, to measure the emotional content of each post.
To find if there's a causal relationship, the researchers needed to run an experiment. They found a natural one in rain.
Rainy weather, it turns out, reliably changes the tenor of posts - increasing the number of negative posts by 1.16 per cent and depressing the number of positive by 1.19 per cent.
To make sure that rain was not affecting the friends directly, they restricted their analysis to friends who were in different cities where it was not raining, and to make sure it was not topic contagion, they removed from their analysis all weather-related status updates.
Each additional negative post yielded 1.29 more negative posts among one's friends, while each additional positive post yielded an additional 1.75 positive posts among friends.
The study was published in the journal PLOS ONE.