In the wake of intense research on metamaterials the two-dimensional analogue, known as metasurfaces, has attracted progressively increasing attention in recent years due to the ease of fabrication and smaller insertion losses, while enabling an unprecedented control over spatial distributions of transmitted and reflected optical fields. Metasurfaces represent optically thin planar arrays of resonant subwavelength elements that can be arranged in a strictly or quasi periodic fashion, or even in an aperiodic manner, depending on targeted optical wavefronts to be molded with their help. This paper reviews a broad subclass of metasurfaces, viz. gradient metasurfaces, which are devised to exhibit spatially varying optical responses resulting in spatially varying amplitudes, phases and polarizations of scattered fields. Starting with introducing the concept of gradient metasurfaces, we present classification of different metasurfaces from the viewpoint of their responses, differentiating electricaldipole, geometric, reflective and Huygens' metasurfaces. The fundamental building blocks essential for the realization of metasurfaces are then discussed in order to elucidate the underlying physics of various physical realizations of both plasmonic and purely dielectric metasurfaces. We then overview the main applications of gradient metasurfaces, including waveplates, flat lenses, spiral phase plates, broadband absorbers, color printing, holograms, polarimeters and surface wave couplers. The review is terminated with a short section on recently developed nonlinear metasurfaces, followed by the outlook presenting our view on possible future developments and perspectives for future applications.