The first problem in your post is that you present an "apparent contradiction" in the Word of God with no attempt to explain of rectify it. The Word does not nor ever will contradict Itself. Everything fits like a hand in a glove, thus if we actually take the time to study, as in 2 Timothy 2:15, we can come an accurate understanding of each of these passages.
The key to this is context. James 1:13 specifically says that God cannot be tempted with evil. "With evil" is the key. Jesus Christ was most assuredly tempted with evil as in Matthew 4:1, "Then was Jesus led up of the spirit into the wilderness to be tempted of the devil." Being tempted of the devil is definitely tempted by evil. Thus a more accurate statement would be, "How could Jesus be God if God cannot be tempted with evil by Jesus Christ was tempted by evil. God cannot be tempted to sin because He is not a man as it says in Numbers 23:19. The devil was trying to tempt Jesus Christ to sin in disobeying God. Of course Jesus Christ was victorious.
Let's look at a couple of places where God was "tempted" in the Old Testament. The first verse I would like to show would be Exodus 17:1-2, "And all the congregation of the children of Israel journeyed from the wilderness of Sin, after their journeys, according to the commandment of the LORD, and pitched in Rephidim: and there was no water for the people to drink. Wherefore the people did chide with Moses, and said, Give us water that we may drink. And Moses said unto them, Why chide ye with me? wherefore do ye tempt the LORD?" Here we see Moses asking the children of Israel why they tempt the Lord. Well a quick glance would have someone say, Oh God was tempted here, but looking deeper into this passage God is not being tempted to sin. They were more like testing God here because they did not believe on Him and thus He had to show another sign of His power. In Exodus 17:7, it explains exactly how they were tempting God. "And he called the name of the place Massah, and Meribah, because of the chiding of the children of Israel, and because they tempted the LORD, saying, Is the LORD among us, or not?" Thus God was not tempted by evil because He was not tempted to sin.
Another passage in the Old Testament where God was tempted would be Numbers 44:20-22, "And the LORD said, I have pardoned according to thy word: But as truly as I live, all the earth shall be filled with the glory of the LORD. Because all those men which have seen my glory, and my miracles, which I did in Egypt and in the wilderness, and have tempted me now these ten times, and have not hearkened to my voice;" Again they are not trying to cause God to sin, they are testing in the fact that God had said the land of Canaan is theirs, but they have decided they were no match for the Canaanites. They had seen the wonderful works of God so many times and still they test His power in not believing in what God could do.