Many planning problems involve nondeterministic actions - actions whose effects are not completely determined by the state of the world before the action is executed. In this paper we consider the computational complexity of planning in domains where such actions are available. We give a formal model of nondeterministic actions and sensing, together with an action language for specifying planning domains. Then, we examine the cases of complete observability, partial observability and no observability, assuming that sensing is done automatically or needs to be done explicitly. We restrict our attention to plans of tractable plan-size or depth. We show that planning with nondeterministic actions for polynomially represented plans has computational complexity equivalent to that of planning with deterministic actions under incomplete knowledge about the initial state, if we the domains include no observability or full observability, and consider an assumption on executability of actions. If the latter takes polynomial time, then our complexity class for all these problems is Sigma^P_2-complete. If the problem of checking executability of actions is NP-complete (the general case), or we allow partial observability or sensing actions, then our complexity class is Sigma^P_3-complete. For plans of polynomial depth, we find that planning in nondeterministic systems with no observations is in Sigma^P_2-complete, contrary to previous conjectures of PSPACE-completeness (Haslum and Jonsson, ECP'99). We also find that planning in nondeterministic systems with full observability or partial observability (with and without sensing actions) is PSPACE-complete for polynomial-depth plans. These results point out cases where it may be useful to use encodings in boolean formulae to perform planning, and they carefully draw the distinctions between the different scenarios involved.