Revenue for April-June TSMC climbed 28 percent to a record $13.29 billion.
For the quarter ending in September, TSMC forecast revenue of $14.6 billion to $14.9 billion, compared with $12.1 billion in the same period a year earlier.
TSMC's business has been supported by a global chip shortage that has forced automakers to cut production and hurt manufacturers of smartphones, laptops and even appliances during the pandemic.
The company said on an analyst call that the auto chip shortage will gradually reduce for its customers from this quarter but expects overall semiconductor capacity tightness to extend possibly into next year.
Chief Financial Officer Wendell Huang said that the second-quarter business was mainly driven by continued strength in high-performance computing (HPC) and automotive-related demand.
"Moving into the third quarter, we expect our business to be supported by strong demand for our industry-leading 5 nanometre and 7-nanometre technologies, driven by all four growth platforms, which are smartphone, HPC, IoT and automotive-related applications."
Most analysts expect strong demand for the company's most advanced 5nm node technology as well as its upcoming 3 nm node, which is scheduled to enter trial production later this year.
For the second quarter, TSMC said profit rose 11 percent to $4.81 billion from a year earlier.
Shares of TSMC, the eleventh most valuable listed company in the world, have gained about 16 percent so far this year, giving it a market value of $567 billion, more than double that of chipmaker Intel.