What a difference six months can make. As of the closing bell on June 27, 2023, the benchmark S&P 500 and growth-powered Nasdaq Composite were up by 14% and 29.5%, respectively, for the year. That's a far cry from the 19% and 33% losses the S&P 500 and Nasdaq respectively registered last year.

Although history would suggest the phenomenal start to the new year will continue, there's no shortage of economic indicators and metrics pointing to downside for the U.S. economy and/or stock market. Playing a little defense might be investors' smartest move for the second half of the year.

What follows are five genius safe stocks -- "safe" in the sense that they're profitable, time-tested, and have the ability outperform in any economic environment -- you can confidently buy for the second half of 2023.

A stopwatch with a second hand that's stopped above the phrase, Time to Buy.

Image source: Getty Images.

Johnson & Johnson

The first safe stock that makes for a smart buy during the second half of 2023 is healthcare conglomerate Johnson & Johnson (JNJ 0.01%). Though healthcare stocks have lagged the broader market through the first half of the year, J&J has all the tools and intangibles needed to deliver steady long-term gains for its shareholders.

What really makes J&J special is its operating model. For over a decade, it's been shifting more of its net sales to pharmaceuticals, which offer higher margins and a faster growth rate than its other segments. However, the company also has its industry-leading medical-technologies division that it can fall back on. As the global population ages and access to medical care improves, the need for medical devices should only grow.

Another reason to trust in Johnson & Johnson is its balance sheet. Ratings agency Standard & Poor's (S&P), a division of S&P Global, has bestowed its highest possible credit rating (AAA) on J&J, signaling that it has the utmost confidence it can service and eventually repay its outstanding debt.

With a forward price-to-earnings ratio of less than 15, Johnson & Johnson's stock is cheaper than it's been in at least a decade.

Enterprise Products Partners

A second safe stock that makes for a surefire buy in the second half of the year (and well beyond) is energy stock Enterprise Products Partners (EPD 0.07%). Whereas most energy stocks are intricately tied to the spot price movements in crude oil and natural gas, Enterprise avoids this volatility, thanks to its role as a midstream operator. The company oversees more than 50,000 miles of transmission pipeline and can store in excess of 260 million barrels of liquids. 

The secret sauce for this company is its contracts. The vast majority of Enterprise Products Partners' contracts with drilling companies are fixed-fee. Effectively, the company gets paid a predictable amount, regardless of what's happening with the spot price of crude oil and natural gas. This cash-flow transparency plays a key role in helping the company outlay capital for new projects, acquisitions, and its distribution.

In addition, midstream operators are sitting pretty due to the tight supply market for oil. More than three years of capital underinvestment caused by pandemic-related uncertainty, coupled with Russia's invasion of Ukraine and the supply issues the ongoing war can create for Europe, should buoy the spot price of oil and encourage additional drilling. In other words, we're talking about more opportunities for Enterprise to secure long-term contracts.

In case the above isn't enough, Enterprise Products Partners also offers a 7.5% yield and has increased its base annual distribution in each of the past 25 years.

Multiple rows of electric usage meters on a panel.

Image source: Getty Images.

NextEra Energy

Electric-utility stock NextEra Energy (NEE 1.00%) is another safe stock that makes for a genius buy in the second half of 2023. Even though utilities fell out of favor as large-cap growth stocks rallied to begin the year, NextEra brings a level of revenue and profit predictability to the table that few businesses can match.

As I pointed out earlier this week, what sets NextEra apart from dozens of other publicly traded utility operators is its focus on renewable energy. This is a company with 31 gigawatts (GW) of green energy capacity in operation, 23 GW of which is from wind production and 5 GW from solar.

Both figures are the high-water marks of any utility worldwide. Though investing in clean-energy solutions has been costly, NextEra's reward is substantially lower electricity-generation costs and an adjusted earnings-per-share growth rate of more than 8% since 2007. 

The other assurance investors receive by owning shares of NextEra Energy is demand predictability. Since homeowners and renters need electricity to power certain appliances and systems, demand for electricity doesn't change much from year to year.

Further, the high cost of infrastructure means electric utilities often operate as monopolies or duopolies in the areas they service. With few alternatives for consumers, NextEra's cash flow is highly transparent.

PennantPark Floating Rate Capital

Small-cap companies can be safe stocks, too. Business development company (BDC) PennantPark Floating Rate Capital (PFLT 0.51%) is the perfect example of a genius stock that can be purchased for the second half of 2023.

There are two types of BDCs: equity-focused and debt-focused. PennantPark falls into the latter, with its debt-investment holdings in small-cap and micro-cap companies topping just over $1 billion. Since the middle-market companies PennantPark services have limited access to debt and credit markets, the company is able to net a well-above-average yield on the debt it holds -- 11.8% weighted-average yield on debt investments, as of March 31, 2023. 

However, the factor working in PennantPark's favor more than any other at the moment is the Federal Reserve's hawkish monetary policy. The company's entire debt portfolio has variable rates, so every rate hike has the potential to put more money in its pockets. Since Sept. 30, 2021, the company's weighted-average yield on debt investments has soared from 7.4% to 11.8% -- and the Fed isn't yet done hiking rates.

The cherry on top here is that PennantPark pays a monthly dividend, has increased its payout twice over the past year, and is currently pacing an annual yield of 11.8%. That's more than double the U.S. inflation rate.

Mastercard

The fifth genius safe stock to buy for the second half of 2023 is none other than payment processor Mastercard (MA 1.19%). In spite of growing recessionary fears, this cyclical company is well-positioned to excel.

Though it's true that a recession would likely lead to reduced consumer and enterprise spending, every recession after World War II has lasted between two and 18 months. Comparatively, economic expansions have lasted considerably longer. In fact, the average bull market has been approximately 3.5 times longer than the typical bear market in the S&P 500 since 1929. That's music to the ears of payment processors.

One reason Mastercard has been such a successful company over the long run is its conservative management team. While it would have been easy for the company to shift into lending, management has strictly focused on payment facilitation. With no lending exposure, Mastercard doesn't have to worry about loan losses or setting capital aside when economic turbulence crops up. In short, it's primed to bounce back from recessions faster than most financial stocks.

Mastercard should also enjoy a sustained double-digit growth opportunity in international markets. Cash still accounts for a sizable percentage of global transactions, which provides a long-term opportunity for Mastercard to move its payment infrastructure into underbanked regions of the world.