In this article we study any 4-dimensional Riemannian manifold (M, g) with harmonic curvature which admits a smooth nonzero solution f to the following equationwhere Rc is the Ricci tensor of g, x is a constant and y(R) a function of the scalar curvature R. We show that a neighborhood of any point in some open dense subset of M is locally isometric to one of the following five types;and H 2 (k) are the two-dimensional Riemannian manifold with constant sectional curvature k > 0 and k < 0, respectively, (iii) the static spaces in Example 3 below, (iv) conformally flat static spaces described in Kobayashi's [18], and (v) a Ricci flat metric.We then get a number of Corollaries, including the classification of the following four dimensional spaces with harmonic curvature; static spaces, Miao-Tam critical metrics and V -static spaces.The proof is based on the argument from a preceding study of gradient Ricci solitons [17]. Some Codazzi-tensor properties of Ricci tensor, which come from the harmonicity of curvature, are effectively used.where Rc is the Ricci curvature of g, x is a constant and y(R) a function of R. There are several well-known classes of spaces which admit such solutions.