Elon Musk joined Twitter's board—here's how much you'd have if you invested $1,000 five years ago

Twitter shares continued their sharp climb Tuesday after Tesla CEO Elon Musk joined the social network's board following his purchase of a 9.2% stake in the company.

Musk's 73,486,938 shares make him Twitter's largest shareholder, and were valued by CNBC at $2.89 billion at Friday's closing price — a fraction of the world's richest man's $288 billion fortune, according to Bloomberg.

Musk has for years been>Read more about electric vehicles from CNBC Pro

It's time to buy Nio shares after the Chinese electric vehicle maker's 44% drop, UBS says

Electric, hybrid vehicles will account for nearly 50% of cars on the road by 2040, Goldman predicts

Tesla first-quarter deliveries miss Wall Street expectations slightly. Here's what analysts think

Musk's acquisition sent the social network's stock spiking 27% on Monday, and news of his appointment to the board had the stock up as much as 8% Tuesday morning.

If you had invested $1,000 in Twitter five years ago on April 4, 2017, your investment would be up 252.3% as of Tuesday at 10:49 a.m., according to CNBC calculations, with a total market value of $3,523.23.

It would be worth less, however, if you had invested in Twitter at its 2013 IPO price of $26. The same $1,000 investment made on November 7, 2013 would be worth $1,990 as of Tuesday morning — a return of 99.1%.

Over the same two time periods, the S&P 500 index grew by 93.3% and 161.1%, respectively.

Despite Twitter's growth over the years and Musk's recent involvement, past returns of an individual stock do not predict future results. Make sure to carefully research your options before investing.

And instead of trying to predict which stocks will go up and which will go down, consider buying low-cost index funds and holding onto them. This type of diversified fund typically stays relatively constant and avoids the ups and downs that comes with picking single stocks.