I guess that when you ask the angle between vertices, you mean the angle between the two vectors, starting from the origin and going to the two vertice. Those Vectors are actually the coordinate of the vertice but I prefer to be clear to avoid misunderstanding since the angle between two points dont realy make sense.
So it is actually very easy to obtain an angle between two vectors, you can use the Blender implementation of vectors to do that:
(I usually prefer to work with noramlized() vector but I dont think it is necessary for Vector.angle()
if you want to compute the angle of the two vertice from the center of the sphere, then you need a vector starting from the center and going to each Vertice
You can do something like vector0 = vertice0.co - sphere.location to find this vector.
Keep in mind that if the object has some transformations, location, rotation and scale, you'll need to calculate the world vertice position. You can take a look there for this point
If you want to have a perfect mach of the two vertices when they dont have the same z coordinate, you'll need to rotate around a precies vector and not only the z axis. This vector can be find with a cross product that will give you a vector perpendicular to two other verctors. Your vectors do needs to be normalized in this case
axis = vector0.normalized().cross(vector1.normalized())
If you want tho obtain the angle so that the the rotation on the z axis will align the vertices, except in the z axis, you should compute the rotation on vectors based on a projection of the vertices on a plane with a z normal. To keep it simple in your case, you can juste set the z value to 0 for each vector then normalize them.
Tell me if you need some clarifications on some points.