Aims. Core-collapse supernovae (CC SNe), especially type II-Plateau ones, are thought to be important contributors to cosmic dust production. SN 2004dj, one of the closest and brightest SN since 1987A, offered a good opportunity to examine dust-formation processes. To find signs of newly formed dust, we analyze all available mid-infrared (MIR) archival data from the Spitzer space telescope. Methods. We re-reduced and analyzed data from IRAC, MIPS, and IRS instruments obtained between +98 and +1381 days after explosion and generated light curves and spectra for each epoch. Observed spectral energy distributions are fitted with both analytic and numerical models, using the radiative-transfer code MOCASSIN for the latter ones. We also use imaging polarimetric data obtained at +425 days by the Hubble space telescope.Results. We present convincing evidence of dust formation in the ejecta of SN 2004dj from MIR light curves and spectra. Significant MIR excess flux is detected in all bands between 3.6 and 24 μm. In the optical, a ∼0.8% polarization is also detected at a 2-sigma level, which exceeds the interstellar polarization in that direction. Our analysis shows that the freshly-formed dust around SN 2004dj can be modeled assuming a nearly spherical shell that contains amorphous carbon grains, which cool from ∼700 K to ∼400 K between +267 and +1246 days. Persistent excess flux is found above 10 μm, which is explained by a cold (∼115 K) dust component. If this cold dust is of circumstellar origin, it is likely to be condensed in a cool, dense shell between the forward and reverse shocks. Pre-existing circumstellar dust is less likely, but cannot be ruled out. An upper limit of ∼8 × 10 −4 M is derived for the dust mass, which is similar to previously published values for other dust-producing SNe.