Yes, you can do it componentwisecomponent-wise. As you have three momenta, you have to write Hamilton's equations for all of them.
$\dot{x} = \partial H/\partial p_x$
$\dot{y} = \partial H/\partial p_y$
$\dot{z} = \partial H/\partial p_z$\begin{align}\dot{x} &= \partial H/\partial p_x\\ \dot{y} &= \partial H/\partial p_y \\ \dot{z} &= \partial H/\partial p_z\end{align}
Similarly for the momenta
$\dot{p_x} = -\partial H/\partial x$
$\dot{p_y} = -\partial H/\partial y$
$\dot{p_z} = -\partial H/\partial z$\begin{align}\dot{p_x} &= -~\partial H/\partial x\\ \dot{p_y} &= -~\partial H/\partial y\\ \dot{p_z} &= -~\partial H/\partial z\end{align}