Accurate spectroscopic constants and electrical properties of small molecules are determined by means of W4 and post-W4 theories. For a set of 28 first- and second-row diatomic molecules for which very accurate experimental spectroscopic constants are available, W4 theory affords near-spectroscopic or better predictions. Specifically, the root-mean-square deviations (RMSDs) from experiment are 0.04 pm for the equilibrium bond distances (r(e)), 1.03 cm(-1) for the harmonic frequencies (ω(e)), 0.20 cm(-1) for the first anharmonicity constants (ω(e)x(e)), 0.10 cm(-1) for the second anharmonicity constants (ω(e)y(e)), and 0.001 cm(-1) for the vibration-rotation coupling constants (α(e)). These RMSDs imply 95% confidence intervals of about 0.1 pm for r(e), 2.0 cm(-1) for ω(e), 0.4 cm(-1) for ω(e)x(e), and 0.2 cm(-1) for ω(e)y(e). We find that post-CCSD(T) contributions are essential to achieve such narrow confidence intervals for r(e) and ω(e), but have little effect on ω(e)x(e) and α(e), and virtually none on ω(e)y(e). Higher-order connected triples T(3)-(T) improve the agreement with experiment for the hydride systems, but their inclusion (in the absence of T(4)) tends to worsen the agreement with experiment for the nonhydride systems. Connected quadruple excitations T(4) have significant and systematic effects on r(e), ω(e), and ω(e)x(e), in particular they universally increase r(e) (by up to 0.5 pm), universally reduce ω(e) (by up to 32 cm(-1)), and universally increase ω(e)x(e) (by up to 1 cm(-1)). Connected quintuple excitations T(5) are spectroscopically significant for ω(e) of the nonhydride systems, affecting ω(e) by up to 4 cm(-1). Diagonal Born-Oppenheimer corrections have systematic and spectroscopically significant effects on r(e) and ω(e) of the hydride systems, universally increasing r(e) by 0.01-0.06 pm and decreasing ω(e) by 0.3-2.1 cm(-1). Obtaining r(e) and ω(e) of the pathologically multireference BN and BeO systems with near-spectroscopic accuracy requires large basis sets in the core-valence CCSD(T) step and augmented basis sets in the valence post-CCSD(T) steps in W4 theory. The triatomic molecules H(2)O, CO(2), and O(3) are also considered. The equilibrium geometries and harmonic frequencies (with the exception of the asymmetric stretch of O(3)) are obtained with near-spectroscopic accuracy at the W4 level. The asymmetric stretch of ozone represents a severe challenge to W4 theory, in particular the connected quadruple contribution converges very slowly with the basis set size. Finally, the importance of post-CCSD(T) correlation effects for electrical properties, namely, dipole moments (μ), polarizabilities (α), and first hyperpolarizabilities (β), is evaluated.