how did spain gain great wealth
The vast majority of Spain's wealth came from gold, which was excavated from its various colonies (especially the ones in South America) and shipped back to Spain.