What happened

Shares of Teva Pharmaceutical Industries (NYSE:TEVA), the world's largest producer of generic drugs, rose 28.3% in the first half of 2018, according to data from S&P Global Market Intelligence. A key investor signaled confidence in the company's ability to remain strongly profitable, and investment bank analysts followed suit.

So what 

In the first quarter of the year, Berkshire Hathaway (NYSE:BRK.A)(NYSE:BRK.B) doubled its stake in Teva Pharmaceuticals. When the company run by the world's favorite investor makes a confident move like this, analysts start paying attention. In particular, David Maris, who downgraded Teva Pharmaceuticals in January, completely changed his tune and upgraded the stock a few weeks ago.

Pills on top of money.

Image source: Getty Images.

In all fairness to investment bank analysts, there were plenty of reasons to be frightened of Teva last year. Acquiring Allergan's generic-drug division left the company saddled with $34.7 billion in debt as of the end of September just as generic-drug prices were plummeting. Teva's comeback this year doesn't mean big margins on generic drugs are coming back, but strong cash flows have investors feeling confident Teva can begin raising its dividend again within the next several quarters.

Now what

Cutting around a quarter of its staff hasn't made the company very popular at home, but profitability's up and debt's on the way down fast. Teva generated $1.9 billion in free cash flow during the first quarter, compared to just $0.3 billion during the previous year period. Massive cash flows like these allowed a new management team to reduce the company's massive debt pile 11% to $30.8 billion in just half a year.

Copaxone sales are still getting hammered in the U.S., but today's leaner Teva train has enough steam to pull itself uphill without its former cash cow. If sales of the popular multiple sclerosis treatment simply level off, as they have in Europe, this underdog stock could continue climbing through the end of the year and beyond.