Recently, Horváth et al. (Appl Math Comput, submitted) proposed a novel unified approach to study, i.e., invariance conditions, sufficient and necessary conditions, under which some convex sets are invariant sets for linear dynamical systems. In this paper, by utilizing analogous methodology, we generalize the results for nonlinear dynamical systems. First, the Theorems of Alternatives, i.e., the nonlinear Farkas lemma and the S-lemma, together with Nagumo’s Theorem are utilized to derive invariance conditions for discrete and continuous systems. Only standard assumptions are needed to establish invariance of broadly used convex sets, including polyhedral and ellipsoidal sets. Second, we establish an optimization framework to computationally verify the derived invariance conditions. Finally, we derive analogous invariance conditions without any conditions.