Time has always had a special status in physics because of its fundamental role in specifying the regularities of nature and because of the extraordinary precision with which it can be measured. This precision enables tests of fundamental physics and cosmology, as well as practical applications such as satellite navigation. Recently, a regime of operation for atomic clocks based on optical transitions has become possible, promising even higher performance. We report the frequency ratio of two optical atomic clocks with a fractional uncertainty of 5.2 × 10-17. The ratio of aluminum and mercury single-ion optical clock frequencies νAl+/νHg+ is 1.052871833148990438(55), where the uncertainty comprises a statistical measurement uncertainty of 4.3 × 10-17, and systematic uncertainties of 1.9 × 10-17 and 2.3 × 10-17 in the mercury and aluminum frequency standards, respectively. Repeated measurements during the past year yield a preliminary constraint on the temporal variation of the fine-structure constant α of α˙/α=(-1.6±2.3)×10-17/year.