We present a comprehensive analysis of weak gravitational lensing by large-scale structure in the Hubble Space Telescope Cosmic Evolution Survey ( COSMOS ) , in which we combine space-based galaxy shape measurements with ground-based photometric redshifts to study the redshift dependence of the lensing signal and constrain cosmological parameters . After applying our weak lensing-optimized data reduction , principal component interpolation for the spatially and temporally varying ACS point-spread function , and improved modelling of charge-transfer inefficiency , we measure a lensing signal which is consistent with pure gravitational modes and no significant shape systematics . We carefully estimate the statistical uncertainty from simulated COSMOS-like fields obtained from ray-tracing through the Millennium Simulation , including the full non-Gaussian sampling variance . We test our lensing pipeline on simulated space-based data , recalibrate non-linear power spectrum corrections using the ray-tracing analysis , employ photometric redshift information to reduce potential contamination by intrinsic galaxy alignments , and marginalize over systematic uncertainties . We find that the weak lensing signal scales with redshift as expected from General Relativity for a concordance \Lambda CDM cosmology , including the full cross-correlations between different redshift bins . Assuming a flat \Lambda CDM cosmology , we measure \sigma _ { 8 } \left ( \Omega _ { \mathrm { m } } / 0.3 \right ) ^ { 0.51 } = 0.75 \pm 0.08 from lensing , in perfect agreement with WMAP-5 , yielding joint constraints \Omega _ { \mathrm { m } } = 0.266 ^ { +0.025 } _ { -0.023 } , \sigma _ { 8 } = 0.802 ^ { +0.028 } _ { -0.029 } ( all 68.3 % conf . ) . Dropping the assumption of flatness and using priors from the HST Key Project and Big-Bang nucleosynthesis only , we find a negative deceleration parameter q _ { 0 } at 94.3 % confidence from the tomographic lensing analysis , providing independent evidence for the accelerated expansion of the Universe . For a flat w CDM cosmology and prior w \in [ -2 , 0 ] , we obtain w < -0.41 ( 90 % conf . ) . Our dark energy constraints are still relatively weak solely due to the limited area of COSMOS . However , they provide an important demonstration for the usefulness of tomographic weak lensing measurements from space .