Did the apostle James the Greater travel to Spain and was he martyred in Jerusalem? There are some legends that say that the apostle James the Greater (brother of John) traveled to the actual territory of Spain where he spread the Word. Also there are some accounts that place his final days in Jerusalem where he was martyred.

Is this legend true? Are there any historical accounts that support the legend? Are there any other theories about the later life of apostle James?
Whether or not James the Greater traveled to Spain is highly contested.  

The entry on St. James the Greater in the Catholic Encyclopedia from newadvent.org lists some reasons why this is contested.


  With regard to the preaching of the Gospel in Spain by St. James the
  greater, several difficulties have been raised:
  
  
  St. James suffered martyrdom A.D. 44 (Acts 12:2), and, according to
  the tradition of the early Church, he had not yet left Jerusalem at
  this time (cf. Clement of Alexandria, Stromata VI; Apollonius, quoted 
  by Eusebius, Church History VI.18).
  St. Paul in his Epistle to the Romans (A.D. 58) expressed the
  intention to visit Spain (Romans 15:24) just after he had mentioned
  (15:20) that he did not "build upon another man's foundation."
  The argument ex silentio: although the tradition that James founded
  an Apostolic see in Spain was current in the year 700, no certain
  mention of such tradition is to be found in the genuine writings of
  early writers nor in the early councils; the first certain mention we 
  find in the ninth century, in Notker, a monk of St. Gall (Martyrol.,
  25 July), Walafried Strabo (Poema de XII Apost.), and others.
  The tradition was not unanimously admitted afterwards, while
  numerous    scholars reject it. The Bollandists however defended it
  (see Acta    Sanctorum, July, VI and VII, where other sources are
  given).
  


The fact that James the Greater was martyred in Jerusalem is pretty widely accepted since it is mentioned in the Bible.


  Acts 12:1-2 NIV 
  1 It was about this time that King Herod arrested some who belonged to
  the church, intending to persecute them. 2 He had James, the brother
  of John, put to death with the sword.