Abstract A quasi-smooth derived enhancement of a Deligne–Mumford stack 𝒳 naturally endows 𝒳 with a functorial perfect obstruction theory in the sense of Behrend–Fantechi. We apply this result to moduli of maps and perfect complexes on a smooth complex projective variety. For moduli of maps, for X = S an algebraic K3-surface, g ∈ ℕ, and β ≠ 0 in H 2(S,ℤ) a curve class, we construct a derived stack ℝ 𝐌 ¯ g , n red ( S ; β ) ${\mathbb {R}\overline{\mathbf {M}}^{\text{red}}_{g,n}(S;\beta )}$ whose truncation is the usual stack 𝐌 ¯ g , n ( S ; β ) ${\overline{\mathbf {M}}_{g,n}(S;\beta )}$ of pointed stable maps from curves of genus g to S hitting the class β, and such that the inclusion 𝐌 ¯ g ( S ; β ) ↪ ℝ 𝐌 ¯ g red ( S ; β ) ${\overline{\mathbf {M}}_{g}(S;\beta )\hookrightarrow \mathbb {R}\overline{\mathbf {M}}^{\text{red}}_{g}(S;\beta )}$ induces on 𝐌 ¯ g ( S ; β ) ${\overline{\mathbf {M}}_{g}(S;\beta )}$ a perfect obstruction theory whose tangent and obstruction spaces coincide with the corresponding reduced spaces of Okounkov–Maulik–Pandharipande–Thomas. The approach we present here uses derived algebraic geometry and yields not only a full rigorous proof of the existence of a reduced obstruction theory – not relying on any result on semiregularity maps – but also a new global geometric interpretation. We give two further applications to moduli of complexes. For a K3-surface S we show that the stack of simple perfect complexes on S is smooth. This result was proved with different methods by Inaba for the corresponding coarse moduli space. Finally, we construct a map from the derived stack of stable embeddings of curves (into a smooth complex projective variety X) to the derived stack of simple perfect complexes on X with vanishing negative Ext's, and show how this map induces a morphism of the corresponding obstruction theories when X is a Calabi–Yau 3-fold. An important ingredient of our construction is a perfect determinant map from the derived stack of perfect complexes to the derived stack of line bundles whose tangent morphism is given by Illusie's trace map for perfect complexes.