NEW YORK, July 19 (Reuters) - U.S. banking giants reported lackluster results for investment banking in the second quarter, but that has not stopped investors from buying their stocks as a bet on revived dealmaking.

Goldman Sachs profit slumped 58% to the lowest in three years, it reported Wednesday, yet its shares climbed more than 1%. While Morgan Stanley's earnings slid 14% over a year before, they beat expectations, sending shares more than 6% higher on Tuesday.

So far the signs of revival has not translated into strong investment banking revenue, but markets see a better outlook.

“The feeling is that next year looks better than this year and that we may have seen a low point in investment banking revenues,” said Rick Meckler, a partner at Cherry Lane Investments, a family investment office in New Vernon, New Jersey.

Goldman took $1.4 billion in writedowns in the second quarter tied to its consumer businesses and real estate investments.

Still, “investors believe the wind is at their back for investment banking and that it might be cyclical low point," Meckler said, noting the bank's efforts to fix some of its problems.

In discussing their earnings, Wall Street executives cited a flurry of initial public offerings as an encouraging sign that activity in capital markets will pick up after months in the doldrums.

"Big banks have certainly set a positive tone for the start of Q2 reporting season," said Mike Loewengart, head of model portfolio construction at Morgan Stanley's global investment office. "Whether that translates into similar results for the rest of earnings season — and a significant extension and widening of the recent market rally — remains to be seen."

But top bankers also cautioned that it was soon to call a lasting recovery, citing a litany of risks facing the economy, including interest rates, inflation and geopolitical tensions.

"When I go back and I look historically at other periods where the macro environment has created sharp drops in investment banking activity, they tend to last for a year or so, and then they start to improve," Goldman Sachs CEO David Solomon told analysts on a conference call. "We're starting to see that here - it definitely feels better."

Morgan Stanley's backlog of deals is growing, mergers and acquisitions (M&A) are picking up in some industries such as financials and energy, and underwriting trends are improving, Chief Financial Officer Sharon Yeshaya told analysts on a conference call on Tuesday.

"We expect investment banking to lead the recovery in the next quarter," she said in an interview with Reuters, even though capital markets remained subdued.

Bank of America's profits were better than expected in the second quarter, thanks to a surprise gain in its investment banking unit, where net income surged 76%. The lender was buoyed by a slight pickup in equity capital markets and a focus on its middle-market business.

"We have a very strong and resilient deposit base and we do a lot of moving of money of corporate clients around the world," Alastair Borthwick, BofA's Chief Financial Officer, said on Tuesday. He was referring to the company's transaction services business.

At Citigroup, CEO Jane Fraser warned on Friday that "the long-awaited rebound in investment banking has yet to materialize."

The company has a strong deal pipeline, but has "more work to do" on equity capital markets and M&A, finance chief Mark Mason said.

While some "green shoots" are emerging in the IPO market, JPMorgan Chief Financial Officer Jeremy Barnum said on Friday, it is still too early to call it a trend for broader capital markets.

(Reporting by Tatiana Bautzer, Sinead Carew and Saeed Azhar in New York, additional reporting by Noor Zainab Hussain in Bengaluru; Editing by Lananh Nguyen and Nick Zieminski)