A scale-dependent dynamic subgrid-scale model for large-eddy simulation of turbulent flows is proposed. Unlike the traditional dynamic model, it does not rely on the assumption that the model coefficient is scale invariant. The model is based on a second test-filtering operation which allows us to determine from the simulation how the coefficient varies with scale. The scale-dependent model is tested in simulations of a neutral atmospheric boundary layer. In this application, near the ground the grid scale is by necessity comparable to the local integral scale (of the order of the distance to the wall). With the grid scale and/or the test-filter scale being outside the inertial range, scale invariance is broken. The results are compared with those from (a) the traditional Smagorinsky model that requires specification of the coefficient and of a wall damping function, and (b) the standard dynamic model that assumes scale invariance of the coefficient. In the near-surface region the traditional Smagorinsky and standard dynamic models are too dissipative and not dissipative enough, respectively. Simulations with the scale-dependent dynamic model yield the expected trends of the coefficient as a function of scale and give improved predictions of velocity spectra at different heights from the ground. Consistent with the improved dissipation characteristics, the scale-dependent model also yields improved mean velocity profiles.