Microsoft Corp. MSFT -1.24% is in serious discussions to buy Mojang AB, the Swedish company behind the popular "Minecraft" videogame, according to a person with knowledge of the matter.

The deal would be valued at more than $2 billion and could be signed as early as this week, the person said. A Microsoft spokesman declined comment, as did Mojang Chief Executive Carl Manneh.

A sale would be a surprising turn for closely held Mojang, whose 35-year-old founder, Markus Persson, has shunned outside investment and is revered in the videogame community for railing publicly against big firms, including Microsoft.

Programmers worked in Mojang's office in Stockholm last year. Reuters

Meanwhile, "Minecraft" could reinvigorate Microsoft's 13-year-old Xbox videogame business by giving it a cult hit with a legion of young fans. Mojang has sold over 50 million copies of "Minecraft" since it was initially released in 2009 and earned more than $100 million in profit last year from the game and merchandise. The game is already available on Xbox, as well as on Sony Corp.'s PlayStation, PCs and smartphones.

The popularity of "Minecraft" rests in large part on its open-ended possibilities, letting players build just about anything in a blocky, Lego-style world filled with dangers such as zombies and giant spiders. The game has struck a chord with children and hard-core gamers alike despite pixilated graphics that are a far cry from polished, action-based blockbusters like Microsoft's own "Halo" franchise.

The brand has also grown beyond videogames, striking licensing deals with Scholastic Corp. for handbooks, Lego A/S for toys and Warner Bros. Pictures for a feature film. There is even a popular edition for schools to teach children such subjects as languages and architecture.

(Read more: Microsoft Gets 'Minecraft' Not Founders)

Mojang would be the first multibillion-dollar acquisition by Microsoft's chief executive, Satya Nadella, since he was named to the top job in February. It would also be an unexpected plunge because he has signaled Xbox isn't a core business for Microsoft.

But Mr. Nadella has said that Microsoft views videogames as a way to expand the company's footholds in PCs and mobile phones. In a letter to employees in July, Mr. Nadella called gaming the "single biggest digital life category, measured in both time and money spent, in a mobile-first world."

That message was a rebuttal to critics who said videogames are an expensive and nonstrategic diversion for the company, which makes roughly two-thirds of its gross profit selling software for corporate technology departments. By contrast, the business that includes Xbox consoles had sales of roughly $6.7 billion in the year ended June 30, or about 8% of Microsoft's total revenue for the period.

"Minecraft" could also help Microsoft appeal to a new generation of customers, especially on smartphones where Microsoft has struggled with both its homegrown Windows Phone devices and with apps on rival phone systems.

Only Microsoft's Skype video-calling service is fairly consistently among the 50 top free or paid apps for iPhone or Android smartphones in the U.S., according to mobile-app tracker App Annie.

"Minecraft" is ranked in the top five among U.S. paid apps in the Apple and Google app stores.

The game has also become an integral part of a growing trend to watch game play on video sites such as YouTube and Twitch, which was acquired by Amazon.com Inc. for close to $1 billion. Several "Minecraft" players on YouTube have attracted more than a billion views for their videos.

In the world of games, Stockholm-based Mojang is an outlier, generating outsize profits relative to its small staff.

In contrast to larger game companies such as Zynga Inc. and Electronic Arts Inc., which employ thousands of people to manage dozens of titles, Mojang has deliberately remained small, employing only about 40 people in its studio in Stockholm's hip Södermalm district.

Yet Mojang made a profit of 816 Swedish kroner ($115 million) last year on 2.07 billion kroner in revenue ($291 million). Zynga, which has roughly 3,000 employees, had a $37 million loss last year on $873 million in revenue.

Instead of giving its game away and charging for in-app purchases, as many newer game makers do, Mojang charges flat fees for its games. The Xbox version costs $20, while a download on a PC is $27 and the mobile version is $7.

"Minecraft" started out as a hobby project in 2009, when Mr. Persson—a high-school dropout and former game developer at "Candy Crush" game maker King Digital Entertainment PLC—spent the summer in his small apartment in Stockholm coding what would one day become a global phenomenon.

"Notch," as he is known online to his fans, was obsessed by Lego bricks as a child, and had begun programming on his father's Commodore 128 computer at the age of seven, producing his first game at the age of eight.

Mr. Persson made an early and unfinished build of the game available to download, but sales started out modestly with only a handful sold a day for the first few months.

Slowly, "Minecraft" gained momentum as word-of-mouth and online recommendations started spreading. By 2010, copies of the game were selling fast enough for Mr. Persson to quit his day job.

Mr. Persson established Mojang in 2010 to manage "Minecraft" and build other games, bringing along former King colleague Jakob Porsér and Mr. Manneh, the CEO. The three are still the company's only shareholders and board members.

Children play in a Minecraft tournament during Ascot Dubai Duty Free Shergar Cup on Aug. 9, 2014 in Ascot, England. Getty Images

Mojang's relationship with Microsoft hasn't been without friction. In 2012, Mr. Persson made harsh statements on Twitter about the U.S. software giant and its new Windows 8 operating system, telling Microsoft to "stop trying to ruin the PC."

"Minecraft" can be played on personal computers running Windows 8, but that requires that users download it from Mojang's site rather than Microsoft's own Windows Store. What's more, the game has never been made available for Windows Phone, Microsoft's operating system for phones, because Mojang deemed the platform too small to be worth the while.

Mojang has embraced Microsoft's Xbox gaming console, and it released a first version of the game for the Xbox 360 in 2012, more than a year before Sony's rival PlayStation 3 console got it. A version for the new Xbox One was made available last week. The console versions of "Minecraft" accounted for almost a third of Mojang's revenue last year.

Mr. Persson has regularly thumbed his nose at large corporations with snarky tweets and blog posts. Earlier this year, he canceled a project to bring a version of the game for the Oculus Rift virtual reality headset to protest Facebook Inc. 's $2 billion purchase of the company.

"Facebook is not a company of grass-roots tech enthusiasts," he wrote on his blog at the time. "There's nothing about their history that makes me trust them, and that makes them seem creepy to me," he added.

In another post published in June, Mr. Persson said Mojang "does not exist to make as much money as possible for the owners." Instead, he said, "Mojang exists because I got lucky with 'Minecraft,' and it got way bigger than I could handle on my own."

"Every time a big money-making deal comes up that would make a lot of money, it's of course very tempting," he added. "But at the end of the day we choose to do what either makes the most sense for our products or the things that seem like fun for us at Mojang."

Until now, Mojang's founders have prided themselves on the company's independence. Mojang has routinely dismissed funding overtures from venture-capital companies, as well as outright buyout attempts.

A tight ownership structure has meant that the company has been able to focus its operations, Mr. Manneh told the Journal earlier this year.

"Financially speaking, we have no pressure whatsoever to rush into any new projects," he said. "Besides, we have no outside owners that require us to reach any particular goals."

Write to Evelyn M. Rusli at evelyn.rusli@wsj.com, Shira Ovide at shira.ovide@wsj.com, Sven Grundberg at sven.grundberg@wsj.com and Joann S. Lublin at joann.lublin@wsj.com