We simulate the t-J model in two dimensions by means of infinite projected entangled-pair states (iPEPS) generalized to arbitrary unit cells, finding results similar to those previously obtained by the density-matrix renormalization group (DMRG) for wide ladders. In particular, we show that states exhibiting stripes, that is, a unidirectional modulation of hole-density and antiferromagnetic order with a p-phase shift between adjacent stripes, have a lower variational energy than uniform phases predicted by variational and fixed-node Monte Carlo simulations. For a fixed unit-cell size the energy per hole is minimized for a hole density rho(l) similar to 0.5 per unit length of a stripe. The superconducting order parameter is maximal around rho(l) similar to 0.75-0.8.