We solve the Levi-flat Plateau problem in the following case. Let M ⊂ C n+1 , n ≥ 2, be a connected compact real-analytic codimension-two submanifold with only nondegenerate CR singularities. Suppose M is a diffeomorphic image via a real-analytic CR map of a real-analytic hypersurface in C n × R with only nondegenerate CR singularities. Then there exists a unique compact real-analytic Levi-flat hypersurface, nonsingular except possibly for self-intersections, with boundary M . We also study boundary regularity of CR automorphisms of domains in C n × R.