UPDATE 2-Dropbox shares surge in biggest tech debut since Snap

* Dropbox opens at $29 vs IPO price of $21

* Stock gains as much as 50 pct

* Strong showing in the face of broad weakness in tech sector (Adds details about U.S. markets, quote)

March 23 (Reuters) - Dropbox Inc's shares soared by as much as 50 percent in their first day of trading on Friday as investors rushed to buy into the biggest technology initial public offering in more than a year even as the wider tech sector languished.

The stock opened at $29 on the Nasdaq and shot up to as high as $31.60 in early trading. At the stock's opening price, Dropbox had a market valuation of $12.67 billion, well above the $10 billion valuation it had in its last private funding round.

It was last trading at $29.90, up 42 percent.

Its IPO priced at $21 a share late on Thursday - $1 above the projected range of $18 to $20 each and was several times oversubscribed.

The solid first-day pop in the stock stood in contrast to weakness in the wider U.S. stock market. The S&P 500 slid 0.35 percent while Nasdaq dropped 0.6 percent, adding to losses of more than 2 percent each on Thursday. The S&P tech index was down 0.9 percent.

Dropbox's much-awaited debut marks an end to a long dry spell in the U.S. IPO market for big names in the technology sector. The last so-called tech unicorn to hit the market was Snapchat owner Snap Inc last March, and it is trading roughly 4 percent below its $17 IPO price.

The pop in Dropbox's price may bode well for music streaming service Spotify - valued at roughly $19 billion in the private market - that has also filed for a direct listing and will start trading on the New York Stock Exchange on April 3.

"Dropbox is going public at the right time. It has an attractive story to justify its need for financing and the market dynamics are good," said Josh Lerner, professor of Investment Banking at Harvard Business School.

"But at the same time the environment is also competitive".

The San Francisco-based company, which started as a free service to share and store photos, music and other large files, competes with much larger technology firms such as Alphabet Inc's Google, Microsoft Corp and Amazon.com Inc and also with Box Inc.

It has yet to turn a profit, but that's common for startups that invest heavily in their growth. However, as a public company Dropbox will be under pressure to quickly trim its losses.

The 11-year old company reported revenue of $1.11 billion in 2017, up from $844.8 million a year earlier. Full-year net loss nearly halved from the $210.2 million in 2016.

"The strong performance of the Dropbox IPO may open the door for more technology unicorns to IPO throughout the rest of 2018," said Sohail Prasad, co-founder and co-CEO of Equidate, a platform for trading of shares in private technology firms.

"If investors had bought Dropbox stock within the last six months, theyd be up over 75 percent." (Reporting by Sweta Singh in Bengaluru Additional reporting by Nikhil Subba and Diptendu Lahiri Editing by Dan Burns)