Stocks delivered again in 2014.

Even after a poor start in January and wobbles in October and December, the U.S. market has climbed 13 percent and has ended the year close to record levels. The solid gain has pushed the bull run for stocks into its sixth year, the longest such streak since the 1990s.

The Standard & Poor’s 500 rose 11.4 percent for 2014. The Dow Jones industrial average gained 7 percent and the Nasdaq composite rose 13 percent.

On Wednesday the market started higher but gave up those gains by the afternoon. Utilities fell the most.

Investors have been encouraged by rising corporate earnings and a strengthening U.S. economy, which helped stocks overcome a brief winter chill in growth and tensions with Russia. The stock market also overcame worries about the impact of the end of the Federal Reserve’s stimulus program.

Those who stuck out the market’s ups and downs were rewarded with double-digit returns for the fifth year out of the last six.

“Companies delivered and the ability to produce on the bottom line remained resilient,” said Jeff Kleintop, Charles Schwab’s chief global investment strategist. “Ultimately, that’s what stocks track.”

The stock market also experienced its biggest bout of volatility in more than two years. Stocks plunged as much as 9.8 percent in October on concerns about global growth and worries about the spread of the Ebola virus. The market also managed to climb despite a big drop in oil prices that hit energy companies. Geopolitical tensions flared as Russia seized Crimea, war broke out in eastern Ukraine and the Islamic State group seized swaths of territory in Iraq and Syria.

These were some of the biggest themes in the financial markets in 2014:

A resilient economy

The backdrop for the stock market’s gains was a gradually strengthening U.S. economy. Hiring and consumer confidence continued to improve.

Despite a big contraction in the first quarter caused by an unusually harsh winter, the economy continued to grow. The average pace of growth climbed to 2.7 percent by the end of the year, up from 2.3 percent a year earlier.

Don’t count out bonds

A widely forecast demise for bonds failed to materialize.

Bonds had been expected to slump as the Fed neared the end of its bond-buying stimulus program and growth accelerated. Instead, they rallied as investors became more pessimistic on the outlook for global growth as economies overseas weakened.

Bonds also gained because they looked attractive to overseas investors. Their yields, while close to historically low levels, are still higher than in countries like Germany and Japan.

The yield on the 10-year Treasury note is ending the year at 2.18 percent, after starting 2014 at 3 percent. The Barclays Aggregate Index, which measures the performance of a broad range of bonds, returned 5.9 percent, its best year in three.

Still looking for income

The biggest beneficiaries of lower bond yields were companies that pay rich dividends as investors looked to them as an alternative source of income.

“Investors still want bond-like returns,” said Krishna Memani, chief investment officer of OppenheimerFunds. So “the more bond-like parts of the equity market have done quite well.”

Those sectors included utilities and real estate investment trusts. The utilities sector is ending the year with a gain of 26 percent, the best performance of the 10 sectors that make up the S&P 500 index.

Utility companies in the index have an average dividend yield of 3.3 percent. U.S. REITs pay about 3.6 percent.

Deal revival

It was also a good year for deal-making. The value of global mergers and acquisitions rose to the highest point since 2007, while the number of initial public offerings was the highest since the technology bubble days of 2000.

Among the notable tie-ups announced were Actavis’ agreement to buy fellow drugmaker Allergan for $66 billion in November, and Comcast’s deal to buy Time Warner Cable for $45.2 billion in February.

In IPOs, China’s e-commerce giant Alibaba raised $25 billion in its stock market debut in September, making it the biggest U.S.-listed IPO in history.

Keep the growth coming

U.S. companies, benefiting from low interest rates and a gradually improving economy, have become adept at driving their profits higher since the recession. Those rising earnings are underpinning the rally in stocks.

Earnings at S&P 500 companies are projected to reach a record of $116.97 per share for 2014, an increase of almost 8 percent from a year earlier, according to S&P Capital IQ.

“If you look at the cash flow and profitability of companies today, especially in the U.S., it is just darn impressive,” said Seth Masters, chief investment officer for Bernstein Global Wealth Management.

Cheap oil isn’t all good

Fears of weak growth overseas and worries of a supply glut combined to push oil down 50 percent in six months. After trading at a peak of $107 a barrel in June, oil is ending the year near $53.

Falling oil prices lead to lower gas prices, which is a good thing for consumers. But there are also losers when crude slumps. Energy stocks, which account for about 10 percent of company earnings in the S&P 500 index, plunged.

As the losses in oil accelerated this fall, investors also worried about the wider implications. If prices stay low, some producers could go out of business, costing workers their jobs and prompting defaults in the bond market.

But Airlines, which are heavy users of fuel, were big beneficiaries of the slump. Southwest Airlines’ stock has climbed 128 percent, the biggest gain in the S&P 500.