Previous epidemiological studies have linked short-term exposure to particulate matter with outpatient visits for respiratory diseases. However, evidence on ultrafine particle (UFP) is still scarce in China. To investigate the association between short-term UFP exposure and outpatient visits for respiratory diseases as well as the corresponding lag patterns, information on outpatient visits for main respiratory diseases during January 1, 2017, to December 31, 2019 was collected from electronic medical records of two large tertiary hospitals in Shanghai, China. Generalized additive models employing a Quasi-Poisson distribution were employed to investigate the relationships between UFP and respiratory diseases. We computed the percentage change and its corresponding 95% confidence interval (CI) for outpatient visits related to respiratory diseases per interquartile range (IQR) increase in UFP concentrations. Based on a total of 1,034,394 hospital visits for respiratory diseases in Shanghai, China, we found that the strongest associations of total UFP with acute upper respiratory tract infection (AURTI), bronchitis, chronic obstructive pulmonary disease (COPD), and pneumonia occurred at lag 03, 03, 0, and 03 days, respectively. Each IQR increase in the total UFP concentrations was associated with increments of 9.02% (95% CI: 8.64–9.40%), 3.94% (95% CI: 2.84–5.06%), 4.10% (95% CI: 3.01–5.20%), and 10.15% (95% CI: 9.32–10.99%) for AURTI, bronchitis, COPD, and pneumonia, respectively. Almost linear concentration–response relationship curves without apparent thresholds were observed between total UFP and outpatient-department visits for four respiratory diseases. Stratified analyses illustrated significantly stronger associations of total UFP with AURTI, bronchitis, and pneumonia among female patients, while that with COPD was stronger among male patients. After adjustment of criteria air pollutants, these associations all remained robust. This time-series study indicates that short-term exposure to UFP was associated with increased risk of hospital visits for respiratory diseases, underscoring the importance of reducing ambient UFP concentrations for respiratory diseases control and prevention.