Stocks are simply a share in the ownership of a business. Because of this, stock prices depend on the expected sales and earnings of the business over the long term. When market expectations for a particular company are rising, chances are that the stock price will be rising, too.
If a company is outperforming expectations, this information is gradually incorporated in the stock price. Expectations and stock prices generally move in trends, and academic research has proven that shares in companies with rising earnings expectations tend to outperform the market over time.
In that spirit,