[Tex/LaTex] Align different equations on different equal signs

alignamsmathequations

I am using the \begin{align*} command to structure equations such that they align along the first equal sign. I want to be able to change from one equal sign to another, such that I centre equations a to w on the first equal sign, and then centre the z equation on the second equal sign. Attached is the output I'm getting. Any pointers?

\begin{align*}
a&=b\\
c&=d\\
e&=f+g+h+j=w\\
x&=y\\
z&=0\\
\end{align*}

enter image description here

I would like to be able to align the first three equations on the first equal sign and the last two equations on the second equal sign like so:

a=b
c=d
e=f+g+h+j=w
        x=y
        z=0

Best Answer

Two variants:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{alignat*}{2}
a &= b\\
c &= d\\
e &= f+g+h &{}+j &= w \\
  &        &   x &= y\\
  &        &   z &= 0
\end{alignat*}

\begin{align*}
a &= b\\
c &= d\\
e &= f+g+h\begin{aligned}[t]{}+j &= w \\
                               x &= y\\
                               z &= 0
\end{aligned}
\end{align*}

\end{document} 

The {} in front of + is needed to get the spacing right, because TeX doesn't consider + a unary symbol.

enter image description here