The markets have been in a tailspin recently and for opportunistic investors, it's a great time to secure great dividend stocks at discounted prices. When dividend stocks drop in value, investors earn higher yields and get more bang for their investment bucks.

Walgreens Boots Alliance (WBA -1.18%) and International Business Machines (IBM -8.25%) are top dividend stocks that pay much better than the average S&P 500 yield of 2%, and they've both fallen in price this year. Here's why you might want to add these two income-generating investments to your portfolio today.

1. Walgreens

Walgreens was already a top dividend stock before sliding more than 38% this year (the S&P 500 is up 3% over the same period). A Dividend Aristocrat, the Illinois-based pharmacy retailer has raised its dividends for 45 consecutive years, including a 2.2% increase announced in July. The company will now pay its shareholders a quarterly dividend of $0.46. At a share price of around $35, the stock yields 5.4%. 

Dividends spelled out on a blackboard with other images.

Image source: Getty Images.

Although Walgreens may look like an expensive buy given its trailing price-to-earnings (P/E) multiple of 41, that's mainly because the company is coming off a tough third-quarter where it incurred $2 billion in impairment charges stemming from COVID-19 related shutdowns in the U.K. Walgreens released the results on July 9 for the period ended May 31 and the impairment led to the company incurring a total loss of $1.7 billion.  In each of the previous four quarters, Walgreens had no trouble staying in the black, posting modest but consistent profit margins of 2% or better.

But the company's business still proved to be resilient despite the COVID-19 pandemic. Its top line of $34.6 billion in Q3 was up 0.1% year over year, with its domestic retail pharmacy segment generating comparable sales growth of 3%. Consumers still see a need for the pharmacy retailer and its products and services, which is why it's likely that a recovery will happen in future periods as its sales remain strong. And as long as there aren't any surprise impairment charges, which there shouldn't be, Walgreens should be back in the black in no time. Taking into account analysts' forecasts for next year, Walgreens stock is trading at a forward P/E of 6.9 -- a year ago that multiple was between eight and 10.

Walgreens is also proving to be a fairly stable buy amid the pandemic as it's adapting to consumers' changing wants and needs. On July 16, it announced it would be partnering with food delivery giant DoorDash to help provide on-demand delivery to customers in select cities where they can receive health and wellness and convenience products right to their door.

With a resilient business, a cheap stock price, and a top yield, this is a dividend stock that could add both income and growth to any portfolio. 

2. IBM

IBM is another high-yielding stock that can generate some great dividend income. It's also an Aristocrat, although its dividend streak is more modest, with the tech company raising its payouts for 25 years in a row. Its most recent increase, in April, bumped its quarterly dividend payments by $0.01 to $1.63. With the stock price at around $121, investors today would be earning an annual yield of approximately 5.4%, on par with Walgreens' payout. 

Like Walgreens, this is another pandemic-resilient stock. As more businesses move to the cloud, IBM helps its customers add value. And with its acquisition of Red Hat completed in 2019, the New York-based company's capabilities are even greater and reach a broader customer base. Red Hat's business, known for its commitment to open source and innovation, was a strong point in IBM's second-quarter results, released on July 20, with its sales up 17% year over year. For the quarter ended June 30, IBM's overall revenue was down 5.4% to $18.1 billion. Its overall cloud and cognitive software business, however, which includes Red Hat, rose a total of 3.3% to $5.7 billion.

But as the economy starts to recover, IBM should see much stronger numbers while seeing demand for its cloud business continues to grow. The company's largest segment is global technology services, which include infrastructure and support services, two areas that suffer when business activity levels fall as they have during the COVID-19 pandemic. In Q2, sales from this segment totaled $6.3 billion and declined 7.6% year over year. That's why despite a disappointing showing, IBM still looks to be in a strong position. Once all of its segments start firing on all cylinders, the stock is sure to rally.

With IBM's share price down more than 9% year to date, it's another cheap stock to buy on the dip in 2020. It's trading at a P/E of just 14.5 but its forward P/E is even lower, at around 10.5. A year ago, it was trading at similar multiples but given the potential long-term trends of more businesses doing work on the cloud, there's reason to be optimistic that IBM's sales and profits may be even better than analysts are expecting.

Which is the best stock to buy today?

Both of these stocks look to be promising buys right now. However, I'd give the edge to IBM today. Its yield matches Walgreens' payout and with remote work here to stay even once the pandemic subsides, there are some great growth opportunities ahead for IBM over the long term that make its stock the better overall buy.