We present a new formalism, alternative to the old thermodynamic-Bethe-ansatz-like approach, for solution of the spectral problem of planar N=4 super Yang-Mills theory. It takes a concise form of a nonlinear matrix Riemann-Hilbert problem in terms of a few Q functions. We demonstrate the formalism for two types of observables--local operators at weak coupling and cusped Wilson lines in a near Bogomol'nyi-Prasad-Sommerfield limit.