This paper presents a deterministic distributed algorithm for computing an f(1+ε) approximation of the well-studied minimum set cover problem, for any constant ε > 0, in O(log(f∆)/log log(f∆)) rounds. Here, f denotes the maximum element frequency and ∆ denotes the cardinality of the largest set. This f(1 + ε) approximation almost matches the f-approximation guarantee of standard centralized primal-dual algorithms, which is known to be essentially the best possible approximation for polynomial-time computations. The round complexity almost matches the Ω(log(∆)/log log(∆)) lower bound of Kuhn, Moscibroda, Wattenhofer [JACM’16], which holds for even f = 2 and for any poly(log ∆) approximation. Our algorithm also gives an alternative way to reproduce the time-optimal 2(1+ε)-approximation of vertex cover, with round complexity O(log ∆/log log ∆), as presented by Bar-Yehuda, Censor-Hillel, and Schwartzman [PODC’17] for weighted vertex cover. Our method is quite different and it can be viewed as a locality-optimal way of performing primal-dual for the more general case of set cover. We note that the vertex cover algorithm of Bar-Yehuda et al. does not extend to set cover (when f ≥ 3).