  We present an enhanced version of the multiwavelength spectral modeling code
MAGPHYS that allows the estimation of galaxy photometric redshift and physical
properties (e.g., stellar mass, star formation rate, dust attenuation)
simultaneously, together with robust characterization of their uncertainties.
The self-consistent modeling over ultraviolet to radio wavelengths in
MAGPHYS+photo-z is unique compared to standard photometric redshift codes. The
broader wavelength consideration is particularly useful for breaking certain
degeneracies in color vs. redshift for dusty galaxies with limited
observer-frame ultraviolet and optical data (or upper limits). We demonstrate
the success of the code in estimating redshifts and physical properties for
over 4,000 infrared-detected galaxies at 0.4<z<6.0 in the COSMOS field with
robust spectroscopic redshifts. We achieve high photo-z precision
($\sigma_{\Delta z/(1+z_{spec})}\lesssim0.04$), high accuracy (i.e., minimal
offset biases; median$(\Delta z/(1+z_{spec}))\lesssim0.02$), and low
catastrophic failure rates ($\eta\simeq4\%$) over all redshifts. Interestingly,
we find that a weak 2175A absorption feature in the attenuation curve models is
required to remove a subtle systematic photo-z offset
($z_{phot}-z_{spec}\simeq-0.03$) that occurs when this feature is not included.
As expected, the accuracy of derived physical properties in MAGPHYS+photo-z
decreases strongly as redshift uncertainty increases. The all-in-one treatment
of uncertainties afforded with this code is beneficial for accurately
interpreting physical properties of galaxies in large photometric datasets.
Finally, we emphasize that MAGPHYS+photo-z is not intended to replace existing
photo-z codes, but rather offer flexibility to robustly interpret physical
properties when spectroscopic redshifts are unavailable. The MAGPHYS+photo-z
code is publicly available online.
