The existing frequency control framework in power systems is challenged by lower inertia and more volatile power injections. We propose a new framework for frequency control and congestion management. We formulate an optimization problem that rebalances power, restores the nominal frequency, restores inter-area flows and maintains line flows below their limits in a way that minimizes the control cost. The cost can be squared deviations from the reference generations, minimizing the disruption from the last optimal dispatch. Our control thus maintains system security without interfering with the market operation. By deriving a primal-dual algorithm to solve this optimization, we design a completely decentralized primary frequency control without the need for explicit communication among the participating agents, and a distributed unified control which integrates primary and secondary frequency control and congestion management. Simulations show that the unified control not only achieves all the desired control goals in system equilibrium, but also improves the transient compared to traditional control schemes.