Image source: Getty Images.

The S&P 500 made fresh historical highs on a total return basis, meaning dividends plus capital appreciation, last week. However, that doesn't mean that every stock in the market is necessarily overvalued or even expensive. Far from it, companies such as Apple (AAPL 0.51%) and Ford (F 6.10%) are trading at reasonable valuation levels and offer attractive potential for gains over the years ahead.

The tasty Apple

Apple is going through a challenging phase. Growth in the smartphone industry is slowing down across the world, which is hurting iPhone sales. Additionally, the iPhone 6 was a massive success for the company in 2015, making year-over-year sales comparisons difficult in 2016. Because of these factors, total revenue declined 13% during the quarter ended March 2016, and Wall Street analysts are on average expecting a decline of 15% in revenue for the June quarter.

On the other hand, the company's problems seem to be transitory as opposed to permanent. Apple has an installed base of over 1 billion active devices, and customers are remarkably loyal to the brand. As consumers upgrade their Apple products in the coming years, it should be a strong driver for the business. In addition, the company is expanding into new products and services with initiatives such as Apple Pay, Apple Music, and Apple Watch.

Apple has nearly $233 billion in cash and liquid investments on its balance sheet, and the business brings in tons of cash on a regular basis. This means that the company has plenty of financial resources to invest in all kinds of growth initiatives, while at the same time rewarding investors with increasing dividends and stock buybacks. 

Short-term uncertainty can often be a source of opportunity for long-term investors, and this seems to be the case when it comes to Apple stock. The iPhone maker carries a price-to-earnings ratio around 11, a discount versus an average P/E in the neighborhood of 19 for companies in the S&P 500.

Companies in the hardware and electronics business typically trade at below-average valuation levels because sales tend to be cyclical and volatile. Nevertheless, Apple stock is cheap by its own historical standards. The following chart shows valuation ratios such as price to earnings, price to free cash flow, and enterprise value to EBITDA over the last five years, and the three indicators are near the low end of the range

AAPL PE Ratio (TTM) Chart

AAPL PE Ratio (TTM) data by YCharts.

Both hands on the wheel

Tesla CEO Elon Musk released the second part of his "master plan" last week, and his statement offered an enlightening statistic about the U.S. auto industry. In his own words: 

"The list of successful car company start-ups is short. As of 2016, the number of American car companies that haven't gone bankrupt is a grand total of two: Ford and Tesla. Starting a car company is idiotic and an electric car company is idiocy squared."

The automotive industry is challenging and competitive. Profit margins tend to be low, and companies in the business need to invest big sums of money in plant and equipment to keep production running efficiently. However, Ford has done a great job at increasing productivity and building better vehicles over the past several years, and this is being reflected on the company's financial statements.

Revenue during the first quarter of 2016 grew 11%, to $35.2 billion. Pre-tax profits in the automotive segment marked a new record for the company, at $3.3 billion versus $2 billion in the first quarter of 2015. Automotive operating profit margin came in at 9.8% of revenue, also at record levels. According to the most recent sales report, Ford's sales in the U.S. during the first half of 2016 are the best the company has seen in the last decade. 

Ford stock yields 4.4%. Dividends have more than tripled since 2012, from $0.05 to $0.15 per share quarterly. Besides, the dividend payout ratio is reasonable, in the area of 29% versus earnings expectations for 2016. This means dividend payments are sustainable and that Ford has room to raise dividends in the future. 

On a price-to-earnings basis, Ford stock is cheap. The company is priced at 6.4 times earnings over the last 12 months; this is not only attractive in comparison to the broad market, but also by historical standards. According to data from Morningstar, the average price-to-earnings ratio for Ford over the last five years is around 9.3.

The Foolish takeaway

Buying solid companies at low prices can be a smart strategy for superior returns over the long term. The concept is simple, but finding undervalued companies is more difficult in practice. If you're hunting for bargains, Apple and Ford are two interesting candidates to consider.