In this paper we introduce and study a twisted tensor product construction of nonlocal vertex algebras. Among the main results, we establish a universal property and give a characterization of a twisted tensor product. Furthermore, we give a construction of modules for a twisted tensor product. We also show that smash products studied by one of us before can be realized as twisted tensor products.