Piezoelectric and ferroelectric nanowires exhibit properties and phases that are not available in the bulk. They are extremely promising for functional nanoscale application. On the basis of atomistic first-principles-based simulations, we predict an all-mechanical polarization control in ferroelectric nanowires. We report that the application of uniaxial compressive stress to ferroelectric nanowires with poor surface charge compensation leads to a reversible phase switching between the polar phase with axial polarization and macroscopically nonpolar flux-closure phase. The phase switching is associated with anomalously large changes in polarization and piezoelectric and mechanical response. In particular, in PbTiO nanowires the values as large as 5400 pC/N and 140 TPa are predicted for the piezoelectric coefficient and elastic constant, respectively. Remarkably, the effect persists up to the gigahertz frequency which is potentially promising for nanoscale applications, such as nanogenerators, biomedical electronics, monitoring devices, nanosensors, nanotransducers, and nanoactuators.