Wall Street wrapped up the first half of 2021 at record highs, with investors defying pessimistic projections of a broader pullback and pushing past concerns of rising inflation and potential rate hikes.

The Dow Jones industrial average advanced more than 210.22 points, or 0.6 percent, to close at 34,502.51 on Wednesday. The S&P 500 edged up 5.70 points, or 0.1 percent, to settle at 4,297.50 and chalked up its 34th record finish of the year. The tech-heavy Nasdaq dropped 24.38 points, or nearly 0.2 percent, to end the session at 14,503.95.

Wednesday’s session marked the midway point of a year that saw a new president move into the White House, shift in power on Capitol Hill amid the continuing shocks of the coronavirus pandemic. The three major U.S. indexes are up by double-digit percentages, with the Nasdaq advancing 12.5 percent, the Dow adding 12.7 percent and the S&P 500 surging 14.4 percent since Dec. 31, 2020.

A day earlier, the S&P 500 and the Nasdaq set all-time highs, highlighting Wall Street’s optimism for economic recovery — reinvigorated by widespread vaccinations, businesses ramping up operations and consumers eager to spend after more than a year of restrictions tied to the public health crisis.

“The market action of 2021 is not a surprise to anyone who considered the impact of the vaccine in late 2020,” said David Bahnsen, chief investment officer of the Bahnsen Group, a wealth management firm.

More than half of the U.S. population has now received at least one dose of coronavirus vaccine, according to data from the U.S. Centers for Disease Control and Prevention. As of Wednesday, more than 154.2 million have been fully vaccinated.

Kristina Hooper, the chief global market strategist at Invesco, emphasized the dramatic changes brought on by the vaccines, which have help fuel an economic comeback. Wall Street also has been bolstered by significant spending from Congress and aggressive monetary policy from the Federal Reserve, she said, while corporate earnings are improving.

Investors also appear to be less worried about rising inflation, which had dampened sentiment on Wall Street. Earlier this month, central bankers signaled that rate hikes could arrive in 2023, sooner than previously projected. The Fed offered a more optimistic reading of the economic recovery, estimating growth to hit 7 percent this year, the fastest calendar-year expansion since 1984.

Although the question of how to contend with rising costs remains a point of political contention, Fed Chair Jerome H. Powell said he expects prices to simmer down over time, as the covid-inspired mismatch of disrupted supply and pent-up demand eventually evens out.

Many of the biggest names on Wall Street have thrived during the pandemic. The pharmacy chain Walgreens, which is among the companies distributing coronavirus vaccines, has seen its stock soar 32 percent this year. The tech giants, capitalizing on the nation’s heightened reliance on computing and Web services, also have notched sizable gains. Alphabet shot up nearly 40 percent in the past two quarters. Facebook is up 27 percent for the year, boosted this week by the rulings of a federal judge who dismissed two antitrust lawsuits against the social media company and said the federal government did not provide enough evidence it is a monopoly.

Much like last year, the vast wealth flowing into the portfolios of investors contrasts with the plight of those devastated by the pandemic and whose economic prospects remain uncertain or dim. Though efforts to vaccinate people are well underway in rich countries, poorer nations have yet to inoculate a meaningful portion of their populations. The stark disparity in vaccination rates and the sluggish pace of the rollout abroad have raised worries the virus could mutate into more lethal variants, wreaking havoc on public health and threatening the global economic recovery.

Some public health officials are encouraging people, even those who are fully vaccinated, to continue to wearing masks to curb the growing threat posed by the more contagious delta variant of the novel coronavirus.

In a report published Wednesday by the United Nations, analysts projected that the pandemic could slash as much as $2.4 trillion from the global economy this year due to the loss of international tourism. The uneven vaccine rollout has magnified losses for developing countries, which rely on spending from wealthy foreigners.

“Tourism is a lifeline for millions, and advancing vaccination to protect communities and support tourism’s safe restart is critical to the recovery of jobs and generation of much-needed resources, especially in developing countries, many of which are highly dependent on international tourism,” said Zurab Pololikashvili, secretary general of the United Nations World Tourism Organization.

On Wednesday, payroll firm ADP said 692,000 jobs were added in June, a better than expected showing. The Labor Department will release its own report on Friday.

Global indexes closed the last trading day of June down slightly, with the German DAX falling 1 percent, the Pan-European Stoxx down 0.67 percent, and Hong Kong’s Hang Seng Index shedding 0.6 percent.