I study how central banks should communicate monetary policy in liquidity trap scenarios in which the zero lower bound on nominal interest rates is binding. Using a standard New Keynesian model, I argue that the key to anchoring expectations and preventing self-fulfilling deflationary spirals is to promise to keep nominal interest rates pegged at zero for a length of time that depends on the state of the economy. I derive necessary and sufficient conditions for this type of state-contingent forward guidance to implement the welfare-maximizing equilibrium as a globally determinate (that is, unique) equilibrium. Even though the zero lower bound prevents the Taylor principle from holding, determinacy can be obtained if the central bank sufficiently extends the duration of the zero interest rate peg in response to deflationary or contractionary changes in expectations or outcomes. Fiscal policy is passive, so it plays no role for determinacy. The interest rate rules I consider are easy to communicate, require little institutional change, and do not entail any unnecessary social welfare losses.